Lamer Moments: Listing databases in PostgreSQL
In MySQL you can use 'show databases' along with many other convenient 'show' commands. PostgreSQL is a different beast entirely. using real databases can be challenging if you grew up on MySQL.
Connect to the database with psql:
psql -U postgres template1 opsdb ~ # psql -U postgres template1 Welcome to psql 8.0.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit template1=# select datname from pg_database; datname -------------- template1 template0 mydb typo (4 rows) template1=# quit
After MANY people have pointed out that "dude" \L works in the Interactive Interface. I would like to tell you: This is useless when you are actually using PostgreSQL from within programs / scripts.