Skip to content

Instantly share code, notes, and snippets.

@joselo
Last active August 29, 2015 14:22
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 joselo/3284596ac6d7367e918c to your computer and use it in GitHub Desktop.
Save joselo/3284596ac6d7367e918c to your computer and use it in GitHub Desktop.
Backup and Restore a postgres database
# back the postgres database including the database name (create database... etc.)
pg_dump -C database > database.back
# restore the database
psql < database.back
# Rename database
ALTER DATABASE name RENAME TO new_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment