mysql5.7 简单的备份脚本,测试环境

#bak 
#create by chenzm
riqi=`date +%Y-%m-%d`
bakdir=/www/bakdata/
cd ${bakdir}
/usr/local/mysql/bin/mysqldump -uroot -pmima --skip-lock-tables --default-character-set=utf8 dbname > dbname-${riqi}.sql
zip dbname-${riqi}.sql.zip dbname-${riqi}.sql &>> ./bakmysql.log
rm -rf dbname-${riqi}.sql &>> ./bakmysql.log

一般备份脚本要注意备份目的目录,日期,输出日志等基本信息。