Pg Show Databases
panos July 15, 2022, midnighttitle: "Show Databases in PostgreSQL" layout: post status: publish date: 2022-07-15 description: "How to show databases in PostGRESQL." categories: - programming tags: - databases - postgresql - sql - howto
If you are coming from a MySQL background, SHOW DATABASES; will not work.
Here are two different ways you can show PostgreSQL databases, using the command line:
The \l or \list command
The psql command line interface, provides \l or \list commands, which presents a list of all available databases:
postgres=# \l
Good 'ol select
Another way, is to just run a select against the pg_database system table:
postgres=# select * from pg_database;
Kountanis