Linux环境下的MySQL数据库备份脚本mysql_user="root" # MySQL备份用户mysql_password="abc123" # MySQL备份用户密码mysql_host="192.168.0.10" # MySQL服务器地址mysql_port="3306" # MySQL端口mysql_charset="utf8" # MySQL编码backup_db_arr=("ecshop_dev" "eeshop_prod" "eshop_dev" "fh_web3" "isoeeshop" "kitty" "xilei" "yonghlea_wxmin" ) #要备份的数据库名称,多个用空格分开隔开如("db1" "db2" "db3") backup_location=/services/mysqlbak #备份数据存放位置,末尾请不要带"/",此项可以保持默认,程序会自动创建文件夹expire_backup_delete="OFF" #是否开启过期备份删除ON为开启OFF为关闭expire_days=3 #过期时间天数默认为三天,此项只有在expire_backup_delete开启时有效backup_time=date +%Y%m%d%H%M #定义备份详细时间backup_Ymd=date +%Y-%m-%d #定义备份目录中的年月日时间backup_dir=$backup_location/$backup_Ymd #备份文件夹全路径welcome_msg="Welcome to use MySQL backup tools!" #欢迎语mysql_ps=ps -ef |grep mysql |wc -l mysql_listen=netstat -an |grep LISTEN |grep $mysql_port|wc -l if [ [$mysql