码迷,mamicode.com
首页 > 系统相关 > 详细

linux备份mysq脚本

时间:2016-04-14 11:50:35      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:

filename=`date +%Y%m%d_%H%M%S`
database=finebw
servername=official
createfilename=${servername}_${database}_${filename}
mysqldump -uroot -pfishjoy123456 ${database}>/mnt/mysql_data_bak/${createfilename}.sql
cd /mnt/mysql_data_bak
tar -zcvf ${createfilename}.tar.gz ${createfilename}.sql
rm -rf /mnt/mysql_data_bak/${createfilename}.sql
scp -P 922 ${createfilename}.tar.gz root@115.159.71.13:/mnt/data/remote_mysql_data_bak
find /mnt/mysql_data_bak -mtime +3 -name "${database}_*" -exec rm -rf {} \;

linux备份mysq脚本

标签:

原文地址:http://www.cnblogs.com/zhuawang/p/5390222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!