HOW TO: Backup your MySQL database Print

  • 21

The easiest way to automatically backup your database is with a simple cron job running the following command ever few hours or at least daily:

Change the following to your server's settings:
LOCALHOST - Normally this will be localhost but if you have an external MySQL server this may be different.
DBUSERNAME - Change this to your database username (for security, we recommend that you create a new username just for running backups with reduced permissions).
DBPASSWORD - Change this to your database password.
DATABASE - Replace with the name of your database.
/FOLDER/TO/BACKUP/DATABASE - Change this to the directory you want your backup to be saved too and set the file name to something recognizable (such as the database name), also do not forget to keep the .sql.gz since it is being compressed by gzip and it is easier to restore with the correct filename.

If you have any questions please feel free to contact us and we will be happy to assist with your backup needs.

Was this answer helpful?

« Back