mysqlbinlog读取二进制日志文件时,报错见下图:
ERROR: Error in Log_event::read_log_event(): 'Found invalid event
in binary log', data_len: 103, event_type: 15
Could not read entry at offset 4:Error in log format or read
error
检查mysqlbinlog的命令,发现本机中存在两个mysqlbinlog命令:
检查两个mysqlbinlog的版本,mysqlbinlog -V看到两者的版本不一样:
发现默认的mysqlbinlog是3.0,而新安装的mysql中的mysqlbinlog的版本是3.3
使用以下命令查看二进制文件后,可以正确查看到内容:
/usr/local/mysql_dir/bin/mysqlbinlog /tmp/1.000001
或者
将/usr/bin/上的mysqlbinlog替换成/usr/local/mysql_dir/bin/下的也可以,如cp /usr/local/mysql_dir/bin/mysqlbinlog /usr/bin/mysqlbinlog,替换成功后,再执行命令mysqlbinlog /tmp/1.000001