数据库备份小脚本

#!/bin/bash
BACKUP_DIR=/data/backup
USER=root
PASSWD=root
[ -d $BACKUP_DIR ] || mkdir $BACKUP_DIR
while true;do
cat << EOF
please input a number to choice your back up tool:
1.mysqldump
2.xtrabackup
3.quit
EOF
read -p "Your choose: " choose
case "$choose" in
1)
   mysqldump -u$USER -P$PASSWD -A -F -E -R --single-transaction --master-data=1 --flush-privileges --triggers --default-character-set=utf8 --hex-blob > $BACKUP_DIR/fullback_$(date +%F_%T).sql;;
2)
   innobackupex --user=$USER --password=$PASSWD $BACKUP_DIR;;
3)
   echo "Bye!" && exit 2;;
*)
   echo "choose Error !" && exit 3;;
esac
done

 

数据库备份小脚本

上一篇:SparkSQL电商用户画像(三)之环境准备


下一篇:mongodb compass 无法连接新版问题