欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL 多实例启动和停止脚本

程序员文章站 2024-01-18 19:45:46
...

mysql 多实例启动脚本: #!/bin/bash if [ $1 == ] (输入要停止的mysq端口号)then echo Please input mysqld GNR number 1

mysql 多实例启动脚本:

#!/bin/bash


if [ "$1" == "" ] (输入要停止的mysq端口号)
then
echo "Please input mysqld GNR number 110-112"(这是开启的端口号范围)


elif ([ "$1" != "110" ] && [ "$1" != "111" ] && [ "$1" != "112" ])(匹配要关闭的端口号,,如果匹配成功就关闭掉响应的数据库实例)
then
echo "Please input mysqld port number 110-112"


else
mysqld_multi --defaults-extra-file=/etc/my_multi.cnf start $1
fi
~

mysql 多实例停止脚本:

#!/bin/bash


if [ "$1" == "" ]
then
echo "Please input mysqld GNR number 110-112"


elif ([ "$1" != "110" ] && [ "$1" != "111" ] && [ "$1" != "112" ])
then
echo "Please input mysqld port number 110-112"


else
mysqld_multi --defaults-extra-file=/etc/my_multi.cnf stop $1
fi

MySQL 多实例启动和停止脚本