VPS Setup: Automated Database Backups

This is a subpost of the larger post Updated Comprehensive VPS Setup Documentation.

 

Create a new directory for the backups;

mkdir /var/backups/mysql

 

I added the following line to /etc/crontab in order to facilitate automatic database backups;
0 22 * * * root /usr/bin/mysqldump -uroot -i[MySQL Root Password] [MySQL Database Name] | gzip > /var/backups/mysql/mysql-backup-$( date +'\%Y-\%m-\%d_\%H-\%M-\%S' ).sql.gz