Backup Your MySQL Database Daily!

Here is quick guide to backup your MySQL database daily:

  • This guide is prepared on Ubuntu 12.04LTS, MySQL 5.5.

Save this script anywhere in your database server:

* Edit the red texts for your environment.

  • This script will use /home/username/mysqlbackup folder to save the backup files.
  • It will delete the backup files which are 7 days old. It will hold 8 backup files.

Make the the script file executable:

Test the script by running manually before adding to your crontab.

Add the script to crontab to run it daily:

This job will run at 03:00 everyday.