From 59022556367b45065dfab2098d48851ec35c9676 Mon Sep 17 00:00:00 2001 From: Michael Schlapa Date: Wed, 18 Mar 2020 09:56:49 +0100 Subject: [PATCH] PostgreSQL --- postgresql.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 postgresql.md diff --git a/postgresql.md b/postgresql.md new file mode 100644 index 0000000..89921cd --- /dev/null +++ b/postgresql.md @@ -0,0 +1,34 @@ +# PostgreSQL + +## Interactively create a user + +(Is a `bash` command) + +``` +# createuser --interactive --pwprompt +Enter name of role to add: +Enter password for new role: +Enter it again: +Shall the new role be a superuser? (y/n) n +Shall the new role be allowed to create databases? (y/n) n +Shall the new role be allowed to create more new roles? (y/n) n +``` + +## Create a database + +(Is a `bash` command) + +Also sets the owner + +``` +# createdb -O +``` + +## Commands for the psql shell + +``` +\l list databases +\c connect to a database +\dt list tables +\d describe table +``` \ No newline at end of file