Well..... I've been a lurking member long enough.
So here is my first post.
Here is the backup script I use for my mysql databases.
Code:
----- Begin mysql_backup.sh --------------------------------------------
#!/bin/sh
for i in `mysql -B -e "show databases" | tail +2`; do
mysqldump --opt $i | gzip -9 > /var/backups/mysql/$i.`date --iso-8601`.gz
ls -t /var/backups/mysql/$i.* | tail +7 | xargs rm -f
done
---- End Script -----------------------------------------------------------
This script keeps 8 days worth of compressed mysql backups in /var/backups/mysql . You can easily edit the script to change the number of days of backups you keep. I automate this in a cron job that runs nightly. Works great
Bookmarks