Create a new DB
CREATE DATABASE name_of_db;
Warning
Remember to put a semicolon
;
at the end of the command.
List all DBs
\l
# List of databases
# Name | Owner | Encoding | Collate | Ctype | Access privileges
# -----------+----------+----------+---------+---------+--------------------
# postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
# template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres ...
# template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres ...
# test | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
Go to a DB
\c name_of_db
postgres=# \c test
# You are now connected to database "test" as user "windsuzu".
test=#
Remove a DB
DROP DATABASE name_of_db;
Warning
Remember to put a semicolon
;
at the end of the command.
References