MySQL Auto Backup

The following commands should be run daily.  This will give you a backup for 1 full month.  After 1 month the backups will overwrite the oldest files.  The %d is the day of the month.

GoDaddy:

In your Hosting Dashboard -> Content -> Chron Manager, enter the following line as the command.  Replace <xxx> with the appropriate values.

mysqldump --opt -Q -h <server_address> --user=<username> --password=<password> <database_name> > <your_path>/<database_name>_`date +%d`.sql

BlueHost:

In the CPanel -> Cron Jobs, enter the following line as the command.  replace <xxx> with the appropriate values.

mysqldump --opt -Q -h localhost --user=<username> --password=<password> <database_name> > /<your_path>/<database_name>_`date +%d`.sql
Tagged with: , ,

Leave a Reply