List all databases for Postgresql

Posted on 25-11-2016 by Nadir Latif


Source: http://dba.stackexchange.com/questions/1285/how-do-i-list-all-databases-and-tables-using-psql

To list all postgresql databases, we need to first switch to user postgres using the command su psql. Next we need to login to the postgresql console using the command psql. After that run the command \list. This will list all databases. To run queries on the database fist run the command \connect database_name. Then run your query.