Knowledgebase & Downloads

MySQL backup crontab

It's always recommended to have your own mysql database backups even if you have the backup service with us as our backup service backs up the entire VM, which doesn't lock the MySQL tables to ensure consistency. Here is a simple crontab that will backup your mysql databases nightly:

15 2 * * * /usr/bin/mysqldump --defaults-file=/root/.my.cnf --all-databases | /usr/bin/gzip > /backups/databases_`date +%Y%m%d`.sql.gz

NOTE: IF you have a local root password for mysql make sure in the file /root/.my.cnf the following exists and is correct: