Saturday, April 29, 2017

software recommendation - MySQL Automatic backup tools



I use back-in-time for backuping up my projects. but my Database's are not included. I'd like to backup all database's scheduling by day or hours. Is there any tool to backup MySQL automatically?



MySQL Admin (discontinued - was available in natty) has a backup tool with a (basic) scheduler to make backups on a daily, weekly, or monthly basis. It is even included in Ubuntu: mysql-admin.




Random image from the web: im1



My favourite way ofcourse is command line and I found a backup script on UF.



#!/bin/bash
#Script to make a regular copy of a mysql database and gzip it into the SAVEDIR.

USER="authorized_user"
PASSWORD="the_password"
DATABASE="database_name"

SAVEDIR="/backup"

/usr/bin/nice -n 19 /usr/bin/mysqldump -u $USER --password=$PASSWORD --default-character-set=utf8 $DATABASE -c | /usr/bin/nice -n 19 /bin/gzip -9 > $SAVEDIR/$DATABASE-$(date '+%Y%m%d-%H').sql.gz


Edit the varibles, save it as .bkup.sh and run it in a crontab, then you have an automatic mysql backup. All the code for this script explained here. Kudos to kat_ams.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...