标签:mys fail mba backup roo pwd 语句 root class
#!/bin/bash #备份数据库 dir=/usr/share/nginx/html/project/ssh/backup/`date +%Y%m%d` mysqldb=test musqluser=root mysqlpwd=123456 mysqlicmd=/usr/bin/mysqldump if [ $UID -ne 0 ];then sudo su fi if [ ! -d $dir ];then mkdir -p $dir echo "create $dir now" else echo "$dir exists" fi $mysqlicmd -u$musqluser -p$mysqlpwd -d $mysqldb >$dir/$mysqldb.sql if [ $? -ef 0 ];then echo -e "\033[32mBackup Successfully!\033[0m" else echo -e "\033[32mBackup failded!\033[0m" fi
标签:mys fail mba backup roo pwd 语句 root class
原文地址:https://www.cnblogs.com/ksy-c/p/13192796.html