My MySQL backup

by Martin Bay on 17/04/2010

Having just paid $125 to get a MySQL database recovered I thought it would be timely to figure out a way to make a backup system for my MySQL database(s) on the MediaTemple Grid Service.

Here is how I do it!

Step 1:

The first step is to backup the database(s) to the file system.

Using automysqlbackup I do a daily MySQL backup to the folder /home/dbbackups. This is done for all MySQL databases using the easy to install backup shell script (automysqlbackup.sh).

Just go to http://sourceforge.net/projects/automysqlbackup/, download the script, modify it and upload it to your server.

I use “Cron Jobs” in the Media Temple Control Panel to run the automysqlbackup script daily. The script conveniently handles daily, weekly, monthly folders plus rotation.

Step 2:

Next, I make sure my entire home folder (including the dbbackups) get copied to another server using rsync.

I really like this way of doing it because I think it’s important to have different snapshots of the data from different time periods (daily, weekly, monthly). This way I will be able to restore things deleted weeks ago.

Please let me know if you have questions!

Martin Bay | Martin Bay .NET

Comments on this entry are closed.

Previous post:

Next post: