mysqlbinlog输出为: # at 4 #170207 4:42:36 server id 1 end_log_pos 123 CRC32 0x872c8855 Start: binlog v 4, server v 5.7.14-7-debug-log created 170207 4:42:36 BINLOG ' vN+YWA8BAAAAdwAAAHsAAAAAAAQANS43LjE0LTctZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA AVWILIc= '/*!*/;
fe 62 69 6e:binlog开头魔法数 4字节 event header bc df 98 58:timestamp,小端显示,及0X5898DFBC十进制1486413756,用命令 [root@testmy mysqld.1]# date -d'@1486413756' Tue Feb 7 04:42:36 CST 2017 可以看见时间和mysqbinlog解析的一致4:42:36 0f:event_type为15 01 00 00 00:service_id,小端显示 0X00000001及1 mysql> show variables like 'server_id'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | server_id | 1 | +---------------+-------+ 和mysqlbinlog中的server id 1也是一致的 77 00 00 00:event长度及0X00000077及119,刚好是下一个event 123-4(魔法数)=119 7b 00 00 00:下一个event位置0X0000007b及123,和mysqlbinlog解析的end_log_pos 123一致 00 00:flags,如果为0X0001那么会在MYSQLBINLOG输出中报一个警告说本binlog没有关闭 04 00:binlog 版本,小端显示及0X0004,和mysqlbinlog中的解析Start: binlog v 4一致