#! /bin/bash
STORE_NAME=`date +%m%d`
STORE_DIR='/home/backup/mysql/'
exec 1>/var/log/mysqlbak.log 2>&1
echo mysqlbak begin at `date`
[ ! -d $STORE_DIR ] && mkdir -p $STORE_DIR
/usr/local/mysql/bin/mysqldump -uroot -p'password' databasename > $STORE_DIR/mysql-$STORE_NAME.sql
gzip $STORE_DIR/mysql-$STORE_NAME.sql
find $STORE_DIR -mtime +7 -name '*.sql.gz' |xargs rm -f
echo mysqlbak finish at `date`
STORE_NAME=`date +%m%d`
STORE_DIR='/home/backup/mysql/'
exec 1>/var/log/mysqlbak.log 2>&1
echo mysqlbak begin at `date`
[ ! -d $STORE_DIR ] && mkdir -p $STORE_DIR
/usr/local/mysql/bin/mysqldump -uroot -p'password' databasename > $STORE_DIR/mysql-$STORE_NAME.sql
gzip $STORE_DIR/mysql-$STORE_NAME.sql
find $STORE_DIR -mtime +7 -name '*.sql.gz' |xargs rm -f
echo mysqlbak finish at `date`
0
只是提示已而,不用紧张
模拟人生 发表于 2016-2-16 14:29
铭哥,MYSQL5.6上,mysqldump不允许出现明文的密码,此命令在shell下单独运行能过,但是会出现提示,写到脚 ...
只是提示已而,不用紧张
编辑回复