Http://www.cnblogs.com/bruceleeliya/archive/2012/05/04/2482733.html
use mysqldump to back up the database, upload to the backup server via FTP, and keep the backup files locally.
Create a new Shell script file
vi/home/work/backup.sh
Add the following content:
#! /bin/bashsqlbakname=_u1_sql_$ (date +%y%m%d). Tar.gzmysqldump--user=mysql_user1--password= "Your password"-- Lock-all-tables--all-databases > Backup.sqltar zcvf $SqlBakName backup.sql#ftp to your SERVERFTP-NV 192.168.1.100 < ;< eofuser ftp_user1 "Password1" Cd/home/mysql_backup/put $SqlBakNamequitEOFrm-F backup.sqlmv $SqlBakName/home/ mysql_backup/$SqlBakName
Press: Wq Save and exit
* Add a script to a timed startup item
1 Create a new Cronfile file
Vi/home/work/backup_cronfile
2 Add the following:
XX * * * */home/work/backup.sh
Press: Wq Save and exit
00 00 * * * indicates that the backup.sh file is executed at 0 points per day.
3 Enter the following command:
Crontab/home/work/backup_cronfile
Go centos-mysql backup Shell script