MySQL: Database Backup

Even the backup is physically done once the Linux-based Server Backup is done, it may be usefull to have the complete dump of the MySQL database. This article will help with th successful achievement.

The easiest way, is to update the already prepared (vixie) cron script located in the /etc/cron.daily/syncandencrypt file. Before the rsync command, insert the following script to fully dump the whole database.

mysqldump --user=root --password=**************** --lock-all-tables 
      --all-databases | gzip > /root/mysql-backup.sql.gz

Of course, this command can be applied in a different executable script and run from cron as well.

And that’s pretty much it 🙂

This entry was posted in Linux, Security, Server and tagged , , , , . Bookmark the permalink.