mysql5.6 多实例启动和关闭

#!/bin/bash

m_user=‘mt_user‘
m_password=‘abcd123‘

if [ "$1" == "start" ];then
/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql"$2"/my.cnf &
elif [ "$1" == "stop" ];then
/usr/local/mysql/bin/mysqladmin -u"$m_user" -p"$m_password" -S /tmp/mysql"$2".sock shutdown
else
printf ‘Please enter start+port or stop+port‘
fi

启动

sh /sh/mt_mysql.sh start 3306

sh /sh/mt_mysql.sh start 3316

关闭

sh /sh/mt_mysql.sh stop 3306

sh /sh/mt_mysql.sh stop 3316

时间: 07-06