MySQL分库分表备份

2019-07-06

MySQL分库分表备份

#!/bin/bash
#分库分表备份
#by anthors lrj 2016-6-15
mkdir -p /bash_shell/test_file/$(date +%F)

for db_name in mysql -e "show databases"|sed ‘1,2d‘;do #取库名
for table_name in mysql -e "show tables from $db_name;"|sed ‘1d‘;do #取表名
mkdir -p /bash_shell/test_file/$(date +%F)/$db_name
/usr/bin/mysqldump --lock-tables=0 ${db_name} $table_name|gzip >/bash_shell/test_file/$(date +%F)/$db_name/${dbname}${tablename}$(date +%F).sql.gz
done
done

MySQL分库分表备份

MySQL分库分表备份

原文地址:https://blog.51cto.com/9625010/2417725