先给出实验环境/etc/my.cnf文件内容
修改内容为:
添加了[mysqld_multi]标签和多出来两个数据库的标签[mysqld3307]和[mysqld3308]
配置完成后启动方法,举一例:
mysqld_multi -defaults-file=/etc/my.cnf start 3307
连接方法为,举一例:
mysql -S /tmp/mysql3307.sock
关闭为:
在数据库中创建test用户
mysql> show grants for root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> grant shutdown on *.* to 'test'@'localhost' identified by 'test' with grant option;
Query OK, 0 rows affected (0.00 sec)
然后使用root用户执行:
mysqld_mulit --defaults-file=/etc/my.cnf stop 3307
查看报错日志:
/usr/local/mysql/share/mysqld_multi.log
网站标题:mysql使用mysqld_multi工具启动多实例-创新互联
标题来源:
http://cdxtjz.cn/article/cdpois.html