Network & Systems Architect

Welcome to my little blog. I am mostly techie over here, blogging about networking and system administration topics, but there will also be some Travel Reports from time to time…

How to Backup MySQL using AutoMySQLBackup

November 14, 2008Christian Kildau0 Comments

Have you ever had a hard disk or server failure and lost important docs? Well… I had.

I’ve been looking for a MySQL backup solution for a few days now, found many scripts, but only one that fits all my needs (Separated daily/weekly backups of all my databases, automatic backup rotation and network support): AutoMySQLBackup.

AutoMySQLBackup is a bash-script of about 700 lines. It has no special depends except mysql-client and Bash of course.

Though the current version (2.5) was last updated in 2006 it works very well. Installation and configuration is also pretty simple, just place the script somewhere on your backup server, open the file with your favorite editor and adjust the following:


I have a seperated user for backup which is only allowed to access mysql from the backup server. (You can set this in PhpMyAdmin’s Privileges section if you don’t know how to do it via cmd). You can also tell AutoMySQLBackup to only backup single databases by replacing DBNAMES=all with a space seperated list of your databases. BACKUPDIR is the path where you want to store your the dumps and MAILADDR will get a status message after every run.

Your backupdir will contain something like:


any you’ll be able to restore a database using:

$ gunzip -c |mysql -u backup -p

Are you using another script to backup your mysql databases? Please let me know. I’d like to hear about it.

Leave a Reply

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.