MySQL 5.7开启二进制日志注意事项
最近才开始将部分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#sysvar_log_bin
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-3.html
MySQL 5.7开启二进制日志注意事项的更多相关文章
- 【MySQL解惑笔记】Mysql5.7.x无法开启二进制日志
一.开启二进制日志 1)未开启二进制日志之前: mysql> show variables like 'log_bin'; +---------------+-------+ | Variabl ...
- MySQL复制(二)--基于二进制日志文件(binlog)配置复制
基础环境: 主库 从库 服务器IP地址 192.168.10.11 192.168.10.12 版本 5.7.24 5.7.24 已存在的数据库 mysql> show databases; ...
- mysql数据安全之利用二进制日志mysqlbinlog备份数据
mysql数据安全之利用二进制日志mysqlbinlog备份数据 简介:如何利用二进制日志来备份数据 什么是二进制日志: 二进制日志就是记录着mysql数据库中的一些写入性操作,比如一些增删改,但是, ...
- Linux数据库:MYSQL启用和查看二进制日志
在/etc/my.cnf文件中[mysqld]下加上: server-id = 1 (在整个Mysql集群中保证唯一) log-bin = binlog log-bin-index = binlog ...
- mysql数据安全之利用二进制日志mysqlbinlog恢复数据
mysql数据安全之利用二进制日志mysqlbinlog恢复数据 简介:如何利用二进制日志来恢复数据 查看二进制日志文件的内容报错: [root@xdclass-public log_bin]# my ...
- mysql中如何开启binlog?开启二进制日志文件?binary log?
需求描述: 开启mysql的binlog即binary log日志功能,在此记录下. 版本描述: mysql版本:5.7.21-log 操作过程: 1.修改my.cnf并且将以下参数加入其中,重启my ...
- mysql开启二进制日志
打开xhell进入系统 进入mysql配置文件目录 执行 cd /etc/mysql 首先找到my.cnf这个配置文件,然后使用vim进入文件编辑 放开我标记的地方. 注意我标记的地方,其实这个就是在 ...
- linux下mysql开启二进制日志
mysql的查询日志,慢查询日志,错误日志,网上的设置方法是正确的.但在二进制日志上设置有问题.正确的设置方法如下, 在/etc/my.cnf文件中[mysqld]下加上: server-id = 1 ...
- MySQL知识总结(四)二进制日志
1 定义 bin-log日志记录了所有的DDL和DML的语句,但不包括查询的语句,语句以事件的方式保存,描述了数据的更改过程,此日志对发生灾难时数据恢复起到了极为重要的作用. 2 开启 mysql默认 ...
随机推荐
- JavaScript和Ajax部分(2)
11. DOM如何操作文档的标准节点? 1) 查看节点:使用getElementById(),getElementByName(),getElementByTagName可以查看HTML文档中的任何元 ...
- shell中$后加引号有什么用($"string"和$'string')
bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 有些时候在某些服务管理脚本中看到$"$string& ...
- MySQL中间件之ProxySQL(8):SQL语句的重写规则
返回ProxySQL系列文章:http://www.cnblogs.com/f-ck-need-u/p/7586194.html 1.为什么要重写SQL语句 ProxySQL在收到前端发送来的SQL语 ...
- Ubuntu使用(二)——eclipse配置与问题
eclipse启动错误 修改eclipse.init的配置,主要加-vm以及下面的jre路径,路径前别留空格 之前因为加了空格,一直找不到原因,差点就打算装回windows了 openFile --l ...
- 适用于WebApi的SQL注入过滤器
开发工具:Visual Studio 2017 C#版本:C#7.1 最有效的防止SQL注入的方式是调用数据库时使用参数化查询. 但是如果是接手一个旧的WebApi项目,不想改繁多的数据库访问层的代码 ...
- 【转载】 Sqlserver中DateAdd()函数
在Sqlserver数据库中,DATEADD() 函数在日期中添加或减去指定的时间间隔.例如计算当前时间往后一天的时刻以及往前1天的时刻时间即可使用DateAdd()函数来操作,DateAdd()函数 ...
- JSJ——java基本概念一
Java曾以什么优点吸引你走上程序员这条不归路? 友好的语法.面向对象.内存管理和最棒的跨平台可移植性.write-once/run-anywhere 当然,只有我们真正投身入java才发现有bug要 ...
- Verification and validation
Verification Verification is the process to make sure the product satisfies the conditions imposed a ...
- SqlHelper模板
在实际开发中,我们不会直接使用拼写SQL语句的方法进行数据库操作,而是使用参数化的方法进行数据库操作,这样做的好处很多,不仅提高了程序的健壮性,同时也避免的SQL注入的问题.在这里,笔者为初学者提供一 ...
- python 反射机制在实际的应用场景讲解
剖析python语言中 "反射" 机制的本质和实际应用场景一. 前言 def s1(): print("s1是这个函数的名字!") s = "s1&q ...