+3 votes
in Databases by (10.5k points)
edited by

In MySQL, we use show databases to check the list of databases. What is the equivalent command in postgresql?

1 Answer

0 votes
by (10.5k points)

Once you are on postgres=#  prompt, you need to type the following commands to see the list of databases and tables.

  • \list or \l: to list all databases
  • \dt or \d : to list all tables in the current database

 To connect to a particular database: \connect database_name (e.g. \connect myproject). Once you are connected to a particular database, \dt or \d to list all tables in the current database.

...