wiki:how-to/servers/backup-postgres

Version 2 (modified by Jamie McClelland, 6 years ago) (diff)

--

How do I backup my postgres database?

Most members have MySQL databases, which are backed up for you and stored in the backups directory of your hosting order.

If you are running a postgres database, your database is also included in our backup routine, however, you cannot directly access the database (you'll need to open a ticket to request that it be restored).

You are strongly encouraged to run your own backups as well.

To manually create a backup of your database, type:

pg_dump [dbname] > backup.sql

Replace [dbname] with the name of your database.

Then, you can copy backup.sql to your local computer.

You could also put this command into a cron job so it runs once a day.

You can store your backup file anywhere you would like, however, keeping it in your home directory will help ensure that nobody else on the server can see it (assuming you have kept the default permissions on your home directory).