views:

43

answers:

3

In MySQL I used use database_name;

What's the PostgreSQL equivalent?

+3  A: 
\connect DBNAME
Will Hartung
+1: This is JUST a psql command, in Postgres itself, there is no way to "switch". In fact, psql isn't "switching" in the MySQL context, just closing one connection and opening another.
rfusca
A: 

You can connect to a different database with \c <database> or \connect <database>:

meagar
A: 

At the PSQL prompt, you can do:

\connect (or \c) dbname
Michael Goldshteyn