#! /bin/bash
DBPATH=/server/backup
MYUSER=root
MYPASS=root
MYCMD="mysql -u$MYUSER -p$MYPASS"
MYDUMP="mysqldump -u$MYUSER -p$MYPASS"
[ -d "$DBPATH" ] && mkdir $DBPATH
for dbname in $MYCMD -e "show databases;"| sed '1,2d'|egrep -v "mysql|schema"
;do
mkdir $DBPATH/${dbname}$(date +%F) -p
for table in $MYCMD -e "show tables from $dbname"
;do
$MYDUMP $dbname $table|gzip >$DBPATH/$(dbname)$(date +%F)/${dbname}_${table}.sql.gz
done
done
mysqldump backup script
转载文章标签 linux bash 文章分类 运维
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Mysql backup script
Mysql backup script !
Mysql backup script -
Lync 2013 – Automated Backup Script
Lync 2013 – Automated Backup Script
Lync 2013 – Automate -
Backup Script:Expdp Schema to ASM Storage
Below is a shell script
Oracle 数据库 expdp DBMS_FILE_TRANSFER -
oracle backup
backup
oracle backup -
A Mysql backup script
ck grasp Linux technology knowledge, so as to improve the level of techno
mysql linux centos bash html