MySQL设置log-bin后服务器重启失败的解决办法

来源:互联网 发布:it绩效考核 编辑:程序博客网 时间:2024/06/12 20:19

问题描述:

MySQL中二进制日志功能默认是关闭的,查看各种开启方式后,确定在配置文件中加入如下配置来开启该功能:

[mysqld]log-bin=mysql
之后使用 “systemctl start mysql” 重启服务器,报错“Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.”


解决方法:

在设置 log-bin 的时候同时需要设置 server-id 变量,即在配置文件中添加:

[mysqld]log-bin=mysqlserver-id=1

发现解决方法的方式:

对于使用 systemctl 启动 mysql 服务器出错的情况,查询操作系统的日志。该错误日志位于:/var/log 目录下的 syslog 文件,通过 “cat /var/log/syslog” 查看系统日志,直接找到日志中的 [ERROR] 标签。标签内容如下:


通过该错误日志,即可发现对 binary log 功能设置过程中,没有提供必需的 server-id 值。

0 0