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