首页 技术 正文
技术 2022年11月16日
0 收藏 498 点赞 4,314 浏览 1599 个字

最近才开始将部分MySQL 5.6升级到MySQL 5.7, 在开启MySQL的二进制日志时,发现MySQL 5.7 与MySQL 5.6已有细微区别。如果在my.cnf配置文件中,只设置了全局系统变量log_bin,没有设置全局系统变量server_id的话,那么MySQL启动不了,而且错误日志没有任何错误信息。

查了一下官方文档16.1.6.4 Binary Logging Options and Variables如下所示, 如果没有设置全局系统变量server_id,那么MySQL就不允许启动:

Setting this option causes the log_bin system variable to be set to ON (or 1), and not to the base name. The binary log file base name and any specified path are available as the log_bin_basename system variable.

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

官方文档Changes in MySQL 5.7.3 (2013-12-03, Milestone 13)详细介绍如下:

Important Change; Replication: It was possible to start the server with binary logging enabled but no server ID specified; in such cases, the server would set server_idto 1 (rather than 0) while slaves remained unable to connect.

Now –server-id must be used when starting the server with binary logging enabled, otherwise the server is unable to start. If –server-id=0 is used, this value is no longer changed by the server; in this case, updates are written to the binary log, but slaves are unable to connect. Using –server-id without specifying a value has the same effect as setting it explicitly to 0. (Bug #11763963, Bug #56739)

也就是说,从MySQL 5.7.3以后版本必须配置server-id,否则无法启用MySQL二进制日志,虽然这个知识点没啥技术含量,但是如果不了解的话,就会犯懵:因为MySQL服务启动失败,但是在错误日志里面没有错误信息输出。看不到错误信息,但是启动又失败,你说晕不晕!

service mysqld restart

Redirecting to /bin/systemctl restart  mysqld.service

Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.

参考资料

https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html

https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-3.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,030
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,520
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,368
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,148
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,781
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,859