当前位置:Gxlcms > 数据库问题 > mysqldump不锁表备份single-transaction

mysqldump不锁表备份single-transaction

时间:2021-07-01 10:21:17 帮助过:30人阅读

dumpbackup]# more /home/script/backup/mysql_dumpbackup.sh #!/bin/bash . /etc/profile . ~/.bash_profile backup_date=`date "+%Y%m%d"` delete_date=`date +%Y%m%d -d "7 days ago"` ##生产数据库名清单 /home/middle/mysql57/bin/mysql -h localhost -uubackup -ptest -N -e "show databases"> /tmp/dblist.txt ##循环每个数据库备份 cat /tmp/dblist.txt|grep -v mysql|grep -v performance_schema|grep -v information_schema |grep -v sys|while read line do db_name=$line mysqldump_file=/home/mysqlbak/dumpbackup/${db_name}_${backup_date}.xz /home/middle/mysql57/bin/mysqldump -h localhost -uubackup -ptest ${db_name} --default-character-set=utf8 --set-gtid-purged=OFF --skip-tz-utc --skip-disable-keys --skip-add-locks --single-transaction|xz >${mysqldump_file} delete_file=/home/mysqlbak/dumpbackup/${db_name}_${delete_date}.xz ##删除本地文件 if [ -f "${delete_file}" ];then rm ${delete_file} fi done

 

mysqldump不锁表备份single-transaction

标签:read   ash   bin   rac   isa   gre   gtid   more   add   

人气教程排行