Skip to content

Instantly share code, notes, and snippets.

@warrenlalata
Last active February 2, 2020 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warrenlalata/82f722538e6e0c19146465cce96768c7 to your computer and use it in GitHub Desktop.
Save warrenlalata/82f722538e6e0c19146465cce96768c7 to your computer and use it in GitHub Desktop.
Postgres Cheatsheet
Open psql terminal
psql -U postgres -h localhost
Create database
create database dbname;
List databases
\l
Create user to work with db create
create user username with password 'password';
Drop database
drop database dbname;
Connect to database within psql terminal
\c dbname;
Connect to database
psql dbname;
Show tables
\dt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment