+2 votes
in Databases by (75.9k points)
After creating a new database, how to connect to it?

1 Answer

+1 vote
by (353k points)
selected by
Best answer

On the terminal of PostgreSQL, type the following command to connect to the database.

postgres=# \c database_name

Also, you can specify database name with psql command to connect to that database.

$psql -d database_name