How to back up mysql databases
Why wait until catastrophe strikes to think about backing up your mysql databases? My little brush with catastrophe prompted me to research ways to back up my databases and I settled on AutoMySQLBackup, a script with just a few variables you need to edit to get it working on your system.
Here’s what the script does:
Every day AutoMySQLBackup will run (if setup on /etc/cron.daily) and using mysqldump and gzip will dump your specified databases to the /backups/daily directory, it will rotate daily backups weekly so you should never have more than 7 backups in there.
Every Saturday AutoMySQLBackup will again backup the databases you have chosen but they will be placed into /backups/weekly, these will be rotated every 5 weeks so there should never be more than 5 backups in there.
Every 1st of the month AutoMySQLBackup will create a backup of all databases and place them into /backups/monthly. These will never be rotated so it will be up to you to do your own house keeping. I would suggest taking a copy of this offline every month or two so that if you have a hard drive failure you will be able to restore your database.
I know there are other options out there, but this one only took about 10 minutes from google to implementation.