Last active
August 29, 2015 13:56
-
-
Save spra85/9095418 to your computer and use it in GitHub Desktop.
Helpful Postgres snippets
This file contains hidden or 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
// Change owner of database | |
ALTER DATABASE name OWNER TO new_owner | |
// Create DB | |
createdb <database_name> -U <user> | |
// Create DB dump | |
pg_dump -Fc <database name> > db.dump | |
// Restore from DB dump | |
pg_restore -d <database name> < db.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pg_restore -d database_name < path_to_dump.dump