By Alvin Alexander. Last updated: June 4, 2016
Postgresql Backup FAQ: How do I create a backup of a Postgresql database?
Solution: I create a Postgresql backup (a Postgresql dump) for this website using the pg_dump
command, like this:
pg_dump -h db_server -U db_user -W db_name > db.20070725.dump Password:
With this Postgres / pg_dump command I'm doing the following:
- Connecting to a Postgres server named "db_server".
- Connecting as the Postgres user "db_user".
- Forcing a password prompt with "-W".
- Dumping the Postgres database (a "Postgres dump" of the database) named "db_name".
- Sending the Postgres output to a file named "db.20070725.dump".
As a final note, here is a link to some "backup and restore" documentation at the Postgresql web site.