How to switch databases in psql?

Blankman picture Blankman · Oct 16, 2010 · Viewed 698.3k times · Source

In MySQL, I used use database_name;

What's the psql equivalent?

Answer

Will Hartung picture Will Hartung · Oct 16, 2010

In PostgreSQL, you can use the \connect meta-command of the client tool psql:

\connect DBNAME

or in short:

\c DBNAME