标签:
#!/bin/bash
DBS=$(mysql -u root -padmin -e ‘use database; show tables;‘ | awk ‘{ print $1 }‘);
for table in ${DBS}
do
dbbak="/home/db/backups/db-"${table}".sql";
dbbakgz=$dbbak".part.gz";
if [ -n "$(echo ${table:0-1}| sed -n "/^[a-z]\+$/p")" ];then
mysqldump -u root -padmin database ${table} > $dbbak;
gzip $dbbak;
fi
done
标签:
原文地址:http://www.cnblogs.com/yuqianwen/p/5612086.html