Default database named postgres on Postgresql server

When a client application connects to a Postgres server, it must specify which database that it wants to connect to. If you don’t know the name of a database (within the cluster serviced by the postmaster to which you connect), you can find a list of database names with the command:

psql -l

When you run that command, psql connects to the server and queries pg_database for a list of database names. However, since psql is a Postgres client application, it can’t connect to the server without knowing the name of at least one database: Catch-22. So, psql is hard-coded to connect to a database named “postgres” when you run psql -l, but you can specify a template database in that case:

psql -l -d template1

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)