Last active
August 29, 2015 14:06
-
-
Save scabbiaza/873c12d026e1689ffa89 to your computer and use it in GitHub Desktop.
Postgres sketches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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