This feature goes perfectly with my previous article on Google Drive Syncing. If you pair it with these automatic backups you can have your mysql backups automatically sync to your google drive account. I recommend checking that article out first then returning here and completing this guide as well.
Ubuntu has a package in it’s repos called “automysqlbackup” that is dirt simple to get running out of the box.
sudo apt-get install automysqlbackup
Now here is where you can customize it. The configuration file has a setting that tells it where to create the backup files.
sudo nano /etc/default/automysqlbackup
Look for the line that reads
Change it to where you want the backups stored. If you followed my previous Google Drive guide that would be something similar to this
If you are using Google Drive to back these up you will have one more step. This is due to the fact that the backup files are created as root and grive will run into permission issues trying to sync.
To fix this we will be modifying the grive bash script to change the permissions on the folder (and it’s contents) and then execute grive.
Modify it to look similar to this
chmod 755 /home/
Save the file and you are done.
You can kick it off manually or wait for the cron to execute on it’s own.