Category: Server Admin
Tags: #bash #mysql #cron
Published: 2019-01-19

Rolling MySql Backup

When launched by cron, this script provides a quick solution to scheduled rolling database backups.

view the gist here

Copy the script to your server then set the config variables including the target directory, database and credentials located at the top of the file.

Make the script executable:

   chmod +x

Run the script:


Verify that a valid backup is in the target directory.

Schedule the script to whatever frequency you want using cron:

   crontab -e

Example of every day at 7am:

   0 7 * * * /home/codemonkey/