Skip to content

Instantly share code, notes, and snippets.

@spra85
Last active August 29, 2015 13:56
Show Gist options
  • Save spra85/9095418 to your computer and use it in GitHub Desktop.
Save spra85/9095418 to your computer and use it in GitHub Desktop.
Helpful Postgres snippets
// 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
@erickarias
Copy link

pg_restore -d database_name < path_to_dump.dump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment