How to switch databases in psql?

In this post, we will see how to switch databases in PostgreSQL (psql) command-line interface.

Connect to a specific database

\c database_name
For example, the following command connects to the "employees" database:
mydb=# \c employees
You are now connected to database "employees" as user "postgres".

To quit the psql shell



Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course