mysql启动失败“MySQL Daemon failed to start”

CentOS上,用命令:service mysqld restart 启动mysql报错:

# service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

进入mysql相关目录查看:

# cd /var/lib/mysql/
# ls 
hhw_global  ibdata1  ib_logfile0  ib_logfile1  localhost.localdomain.err  mysql  mysql.sock  test

查看服务器启动日志:

# tail localhost.localdomain.err 
190610 20:16:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
190610 20:16:57 [ERROR] You need to use --log-bin to make --binlog-format work.
190610 20:16:57 [ERROR] Aborting

190610 20:16:57 [Note] /usr/libexec/mysqld: Shutdown complete

190610 20:16:57 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

可用看到,两行报错说的是,开了--binlog-format选项却没有开启bin log,因此mysql进程开不起来。使用如下命令,查看一下配置的位置:

# mysqld --verbose --help|grep -A 1 'Default options'

或者是:

# mysql --verbose --help|grep -A 1 'Default options'

查询结果:

# mysql --verbose --help|grep -A 1 'Default options'
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf 

找到相应的my.cnf,修改相应配置项,重启mysqld服务即可。

posted @ 2019-06-10 20:29  溟漓  阅读(7150)  评论(0编辑  收藏  举报