mysql-shell备份数据库

Linux环境shell脚本编码

mysqlsh -h127.0.0.1 -P$3306 -u$root -p$123456 --js --verbose --log-level=@debug3 -e "util.dumpSchemas(['configdb','userdb'],'/home/mjtabu/database/backupSchemas',{'threads':48})" >/home/mjtabu/log/mysqlshell.log 2>&1

动态传参

dbIp="$1"
dbPort="$2"
dbUser="$3"
dbPass="$4"
schemas="$5"
dumpPath="$6"
theadCount="$7"
mysqlshLogPath="$8"
mysqlsh -h$dbIp -P$dbPort -u$dbUser -p$dbPass --js --verbose --log-level=@debug3 -e "util.dumpSchemas($schemas,$dumpPath,{'threads':$theadCount})" >$mysqlshLogPath 2>&1
I have a dream : Sandy beach B-J-N.
原文地址:https://www.cnblogs.com/mjtabu/p/14502697.html