Understanding the existing databases

Once the database has been launched, we can connect to PostgreSQL using a psql frontend:

psql postgres

Ideally, you connect to a database called postgres, which can be found in any database instance. Some systems don't encourage people to log in as a postgres user. Therefore, you might want to use sudo here as well to log in to PostgreSQL. If this works for you, you can make PostgreSQL display a list of existing databases, where \l will do the job:

postgres=# \x
Expanded display is on.
postgres=# \l
List of databases
-[ RECORD 1 ]-----+----------------------
Name              | postgres
Owner             | postgres
Encoding          | UTF8
Collate           | en_US.UTF-8
Ctype             | en_US.UTF-8
Access privileges |
-[ RECORD 2 ]-----+---------------------- ...

Get PostgreSQL Administration Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.