在我的my.cnf中,我写道:
[mysqld_multi]
mysqld = /usr/local/Cellar/mysql/5.7.11/bin/mysqld_safe
mysqladmin = /usr/local/Cellar/mysql/5.7.11/bin/mysqladmin
user = root
password =
[mysqld1]
pid-file = /usr/local/etc/mysql/mysqld.pid
socket = /usr/local/etc/mysql/mysqld.sock
port = 3306
datadir = /usr/local/var/mysql
log-bin=mysql-bin
server-id=1
[mysqld2]
pid-file = /usr/local/etc/mysql/mysqld1.pid
socket = /usr/local/etc/mysql/mysqld1.sock
port = 3307
datadir = /usr/local/var/mysql1
server-id=2
language=/usr/local/Cellar/mysql/5.7.11/share/mysql/english
user=mysql
然后我执行mysqld_multi start 2
,我收到错误信息:
Installing new database in /usr/local/var/mysql1
2016-09-19 19:37:16 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2016-09-19 19:37:16 [ERROR] Can't locate the language directory.
FATAL ERROR: Tried to start mysqld under group [mysqld2],
but no data directory was found or could be created.
data directory used: /usr/local/var/mysql1
我无法启动mysql进程,那么问题是什么?目录/usr/local/var/mysql1
似乎有一些问题,但目录存在,它很混乱。
答案 0 :(得分:1)
似乎mysqld_multi没有固定使用mysqld --initialize
。
您必须在my.cnf中为该服务器运行mysqld --initialize
以及所有与目录相关的选项。
(来自评论)
您还可以按照Running two instances of mysql中的说明修复mysqld_multi
脚本。