From 57156de1a3707689f7bb8f7c9a360ec76ed908a6 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 11 Sep 2019 13:45:58 +0300 Subject: [PATCH] Cheat sheet for PostgreSQL --- sheets/postgresql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sheets/postgresql diff --git a/sheets/postgresql b/sheets/postgresql new file mode 100644 index 0000000..9f0c070 --- /dev/null +++ b/sheets/postgresql @@ -0,0 +1,10 @@ +# PostgreSQL database administration + +# check connection to a database on host `localhost` and port `5432` +pg_isready -h localhost -p 5432 + +# backup database named `anitya`, add CREATE statement +sudo -u postgres pg_dump -C anitya > anitya.dump + +# restore database +sudo -u postgres pqsql -f anitya.dump