Postgres Cheatsheet


~/Applications/ -s chris

Commands in psql

Command Actions
\l List all databases
\c dbname Connect to new database
\dt View list of relations/tables
\h Get a help on syntax of SQL commands
\? Lists all psql slash commands.
\set System variables list.
\q Quit psql


Connection parameters When using a GUI program, here are the connection parameters you need to enter:

Host: localhost Port: 5432 (default) User: your user name Password: blank Database: same as user name If you need to provide an URL (eg. for Induction), use postgresql://YOURUSERNAME@localhost/YOURUSERNAME

GUI Tools

PG Commander

PG Admin

Common pitfalls

  • Not including the path. ** Add to the ~/.bash_profile and use source ~/.bash_profile to reset it on the current terminal.

blog comments powered by Disqus