Command
psql -U username -d dbname
Explanation
Connects to the specified PostgreSQL database using the given username.
Examples
Connect as postgres user to mydb
psql -U postgres -d mydb
psql -U username -d dbname
Connects to the specified PostgreSQL database using the given username.
Connect as postgres user to mydb
psql -U postgres -d mydb