Shell script to backup mysql database.
- mydumper
You can also setup cron job to backup mysql database everyday. Add this line in crontab file
@daily /bin/sh <PATH TO BACKUP FOLDER>/db_backup.sh
Example to install mydumper
in CentOS 7
# install depend
yum install glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel cmake
# download
wget https://launchpad.net/mydumper/0.9/0.9.1/+download/mydumper-0.9.1.tar.gz
# make and install
tar -zxvf mydumper-0.9.1.tar.gz
cd mydumper-0.9.1
cmake .
make && make install
# mydumper, myloader will be in /usr/local/bin
# check
mydumper --help
# create backup folder
mkdir /home/work/workplace/backup/db/data -p
mkdir /home/work/workplace/backup/db/log
# modify config
vi <PATH TO BACKUP FOLDER>/db_backup.sh
# change permissions
chmod +x <PATH TO BACKUP FOLDER>/db_backup.sh
# execute
<PATH TO BACKUP FOLDER>/db_backup.sh
The MIT License (MIT). Please see License File for more information.