psql -d mydb

Category: Databases & SQL

psql -d mydb

Start an interactive psql session

Connects to the local mydb database over the default Unix socket and drops you into a REPL (read-eval-print loop) with a mydb=> prompt. Type \? to list meta-commands and \q to quit. Related: \l to see which databases exist.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.