Sample working backup script for MySQL


#echo "analyzing all tables";
#mysqlcheck -Aa 

BACKUPFILE=$(date +"i88-%m-%d-%y-%H%M.sql");

echo "starting sql dump";
#using bzip2 use up less space, but slower
#mysqldump --max_allowed_packet=1G  --compress  --quick --lock-tables --add-locks --comments --compact --dump-date  --routines --triggers  i88 | bzip2 >  /home/ruz/database/$BACKUPFILE.bz2

mysqldump --login-path=local  --max_allowed_packet=1G  --comments  --dump-date  --routines --triggers --events --lock-all-tables i88  >  /var/lib/mysql/$BACKUPFILE

echo "backup complete"
#delete backup files older than 2 weeks.
#/usr/bin/find /path/to/database/ -name "i88*.sql" -mtime +14 -delete
Post a Comment

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...