代码改变世界

启动mysql报错 -- ERROR! The server quit without updating PID file

2017-09-21 10:57  abce  阅读(3969)  评论(0编辑  收藏  举报

开发说某个测试环境的mysql,无法重启了,报以下错误提示:

# service mysqld restart
Shutting down MySQL.. SUCCESS! 
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/test.pid).
# ps -ef|grep mysql|grep -v grep
avahi      697     1  0 Sep16 ?        00:00:02 avahi-daemon: running [test.local]
# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/test.pid).

 

看了一下错误日志,居然没有任何提示。问他重启之前做了什么操作没有,回答说只是开启了二进制,然后尝试重启就报错了。

 

查看了一下my.cnf文件,的确是加了一个参数:

log_bin=binlog

  

但是发现没有设置server-id,于是在配置文件中设置一个server-id:

server-id=1

  

重启成功!

 

错误原因可以从官方文档设置log-bin章节看到:

If you specify this option without also specifying a --server-id, the server is not allowed to start. (Bug #11763963, Bug #56739)