MySQL database backup: Full backup + incremental backup ************************************************************************************** Scheduled Tasks: crontab -e -u root00 6 * * 1 /shell/mysqlbak.sh &> /dev/null00 23 * * 2-7 /shell/mysqladd.sh & > /dev/null************************************************************************************** Backup database Script (mysql): Vim /shell/mysqbak.sh#!/bin/bashif [ ! -e /mysqldata ];thenmkdir /mysaldatafiday= ' date +%f ' mysqldump -u root -p123456 mysql > / Mysqldata/mysql. $Day. sql# chmod +x /shell/mysqbak.sh******************************************* Backup Database log script (all journal files): Vim /shell/mysqllogall.sh#!/bin/bash#/logdir Start Binlog log, name the log file with your own name  , log file save to/logdir directory #/baklogdir plan binlog log backup directory if [ ! -e /baklogdir ];thenmkdir /baklogdirfifor log in ' cat /logdir/glk.index ' dologname= ' echo $log | awk -F "/" ' {print $3} ' cp -rf /logdir/$logname /baklogdir/donechmod +x /shell/mysqllogall.sh*************************** Backup Database log script (new Journal file): vim /shell/mysqllogadd.sh#!/ bin/bash#/logdir start the Binlog log, use your name to log files, save to/logdir directory #/baklogdir plan binlog log backup directory if [ ! -e /baklogdir ];thenmkdir /baklogdirfifor log in ' cat /logdir/ Glk.index ' dologname= ' echo $log | awk -F "/" ' {print $3} ' if [ ! -e /baklogdir/$logname   ];THEN    CP -RF /logdir/$logname /baklogdir/ fidonemysql -uroot -p123456 -e "Flush logs" &Nbsp;&> /dev/nullchmod +x /shell/mysqllogadd.sh****************************************** today, beginner MySQL database backup, here to remember. 2016-05-27 21:50
This article is from "thorough learning or thorough execution!" "Blog, be sure to keep this provenance http://guolikai.blog.51cto.com/11566459/1783929
MySQL database backup: Full backup + incremental backup