Categories
Backup Linux MySQL

MySQL: backup your databases

I have put an interesting bash script to backup your database on my git page. You can find it here on https://github.com/afeys/backupmysql/.

Feel free to use and modify it however you please. If you add interesting functionality, or find any annoying bugs, then some feedback through github would be nice.

You can use this script interactively by just typing ./backupmysql.sh in the scripts folder, or you can find out about all the parameters it accepts by using the -h switch.

The script also allows you to create config files with all necessary info to backup a database and then run or schedule it with

/home/backupadmin/scripts/backupmysql.sh -c /home/backupadmin/configs/mycompanydatabase.config > /var/log/backupdatabase.log

Where mycompanydatabase.config is a textfile containing something like this:

databasehost = 10.10.10.1
databaseuser = backupuser
databasepassword = myverysecretdatabasepassword
backupmode = DATA
targetdirectory = /mnt/backupserver/backups/databases
tempdirectory = /tmp
comment = daily backup

Leave a Reply

Your email address will not be published. Required fields are marked *