OnCallReady

Commands

createdb - create a new PostgreSQL database

createdb [OPTION]... [DBNAME] [DESCRIPTION]

Options you will use

-O, --owner=OWNER
database user to own the new database.
-T, --template=TEMPLATE
template database to copy.
-E, --encoding=ENCODING
encoding for the database.
-h, --host=HOSTNAME
database server host or socket directory (default: the Unix socket in /var/run/postgresql). A value starting with / is a socket directory; anything else is TCP.
-p, --port=PORT
database server port (default 5432).
-U, --username=USERNAME
database user name (default: your OS user name).
-w, --no-password
never prompt for a password (fail instead: what scripts want).
-W, --password
force a password prompt (normally automatic).

Examples

$ sudo -u postgres createdb -O orders_owner orders

a database owned by its owner role

Taught in

Try createdb in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.