Skip to content

Instantly share code, notes, and snippets.

@scabbiaza
Last active August 29, 2015 14:06
Show Gist options
  • Save scabbiaza/873c12d026e1689ffa89 to your computer and use it in GitHub Desktop.
Save scabbiaza/873c12d026e1689ffa89 to your computer and use it in GitHub Desktop.
Postgres sketches
# Install
# http://postgresapp.com/
# http://postgresapp.com/documentation/cli-tools.html
DROP USER <username>;
CREATE USER <username> WITH PASSWORD '<password>';
CREATE DATABASE <database-name>;
GRANT ALL privileges ON DATABASE <database-name> TO <username>;
# Create DB
createdb <dbname>
# Drop DB
dropdb <dbname>
# Create dump
pg_dump -U <user> -h <host> <dbname> -f dump.sql
# Restore dump
psql -U postgres -d <dbname> -f <path_to_dump>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment