Open an interactive psql session to a database.
Section: Connect and Inspect with psql
Connect to a database
bash
bash
psql -d appdbExplanation
Use environment variables like PGHOST, PGPORT, PGUSER, and PGPASSWORD to avoid repeating connection flags.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Connect and Inspect with psql