mysql 多实例启动和停止脚本

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 多实例启动和停止脚本)