Simple MySQL backup script

Here’s a simple MySQL backup script to backup all of your databases at once (and then compress the backup with bzip2) to be used in a crontab:

/usr/bin/mysqldump --all-databases | /usr/bin/bzip2 > /backup/mysql-`date +%Y-%m-%d`.bz2

Be sure to change the application paths as needed (you can use the application whereis for this purpose) and change the backup location to wherever you like.

Share this Post