MySQL Backups Made Easy

Standard

Using logrotate makes it very easy to create MySQL dumps regularly. Just create a file at /etc/logrotate.d/ with the following content:

/var/backups/mysql/dump.sql {
daily
rotate 14
missingok
compress
postrotate
/usr/bin/mysqldump -u -p --opt \
--flush-logs --all-databases > /var/backups/mysql/dump.sql
endscript
}

You may have to create the directory /var/backups/mysql/ manually.