MySQL binlog_rows_query_log_events在线设置无效

binlog_rows_query_log_events 对binlog_format=row有效,设为true后可以在binary log中记录原始的语句

官方文档显示binlog_rows_query_log_events是动态参数,可以在线设置生效,但是测试中发现只有重启才可以生效

版本信息

22:25:13[test](;)> select version();
+------------+
| version()  |
+------------+
| 5.7.10-log |
+------------+

[root@mysql-bcc03 3309_test]# mysqlbinlog --version
mysqlbinlog Ver 3.4 for linux-glibc2.5 at x86_64

在线变更测试

22:22:32[test](;)> set global binlog_rows_query_log_events=1;
Query OK, 0 rows affected (0.00 sec)

22:24:59[test](;)> update t6 set id=3 where id =2;

# mysqlbinlog -v -v  mysql-bin.000002 --base64-output='decode-rows'
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#171113 22:13:35 server id 10211192  end_log_pos 123 CRC32 0x106f7540   Start: binlog v 4, server v 5.7.10-log created 171113 22:13:35
# at 123
#171113 22:13:35 server id 10211192  end_log_pos 154 CRC32 0xdb6b8ed7   Previous-GTIDs
# [empty]
# at 154
#171113 22:13:48 server id 10211192  end_log_pos 219 CRC32 0x837c9303   GTID    last_committed=0        sequence_number=1
SET @@SESSION.GTID_NEXT= '95bd577a-5fbd-11e7-ab42-fa163eef641d:1'/*!*/;
# at 219
#171113 22:13:48 server id 10211192  end_log_pos 291 CRC32 0x7cffa554   Query   thread_id=6982929       exec_time=0     error_code=0
SET TIMESTAMP=1510582428/*!*/;
SET @@session.pseudo_thread_id=6982929/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=1344798720/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
# at 291
#171113 22:13:48 server id 10211192  end_log_pos 336 CRC32 0x73164254   Table_map: `test`.`t6` mapped to number 8329
# at 336
#171113 22:13:48 server id 10211192  end_log_pos 512 CRC32 0xddf3d784   Update_rows: table id 8329 flags: STMT_END_F
### UPDATE `test`.`t6`
### WHERE
###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
### SET
###   @1=3 /* INT meta=0 nullable=1 is_null=0 */

 binlog中显示# [empty]   正常应该是原始语句

测试重启再配置文件中添加global binlog_rows_query_log_events=1,执行同样的操作查看binlog

 

BEGIN
/*!*/;
# at 776
#171113 22:22:32 server id 10211192  end_log_pos 835 CRC32 0xc7f76055   Rows_query
# update t6 set id=1 where id is null
# at 835
#171113 22:22:32 server id 10211192  end_log_pos 880 CRC32 0x96cc634f   Table_map: `test`.`t6` mapped to number 133
# at 880
#171113 22:22:32 server id 10211192  end_log_pos 922 CRC32 0x68f485cf   Update_rows: table id 133 flags: STMT_END_F
### UPDATE `test`.`t6`
### WHERE
###   @1=NULL /* INT meta=0 nullable=1 is_null=1 */
### SET
###   @1=1 /* INT meta=0 nullable=1 is_null=0 */

 

总结就是需要重启才可生效(不知道是否是自己遗漏了什么)

 

转载于:https://www.cnblogs.com/Bccd/p/7828663.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值