在我的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有一些问题,但是目录存在,令人困惑。

最佳答案

似乎mysqld_multi并未固定为使用mysqld --initialize

您必须在该服务器的my.cnf中运行mysqld --initialize以及所有与目录相关的选项。

(来自评论)
您也可以按照Running two instances of mysql中的说明修复mysqld_multi脚本。

关于mysql - 为什么mysqld_multi无法启动mysql?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39572451/

10-11 03:07