read -p "请输入要备份的数据库" name
iname=$name$bak
#dd=`docker exec -i mysql mysql -uroot -proot -e "select table_name from information_schema.tables where table_schema='$name';"|grep -Evi "table_name"`
dd=`docker exec -i mysql mysql -uroot -proot -e "use gdxl;show tables" | grep -v "Tables_in_gdxl"`
docker exec -i mysql mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS $iname"
for i in $dd
do
#echo $i
#echo "$iname"
docker exec -i mysql mysql -uroot -proot -e "CREATE TABLE $iname.$i LIKE $name.$i;"
docker exec -i mysql mysql -uroot -proot -e "INSERT INTO $iname.$i SELECT * FROM $name.$i;"
if [ $? -eq 0 ];then
echo "$i=ok"
else
echo "$i=no" >> /root/shuju
fi