how to change database in cmd in psql code example Example: change database postgres psql: \connect DBNAME. or in short: \c DBNAME.