Last active
August 29, 2015 14:26
-
-
Save vladimir-e/07f9d6c136fff9a69955 to your computer and use it in GitHub Desktop.
Backup and Restore PostgreSQL Database Using pg_dump and psql
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
# http://www.thegeekstuff.com/2009/01/how-to-backup-and-restore-postgres-database-using-pg_dump-and-psql/ | |
# Backup: | |
$ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql} -W | |
# requires to configure md5 auth: | |
sudo vim /etc/postgresql/9.4/main/pg_hba.conf | |
# add: | |
# local all apps md5 | |
# Restore: | |
# Peer auth | |
sudo -u postgres psql -d tagfund_productions -f tag_development.sql | |
# Password auth | |
psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment