日期:2014-05-16  浏览次数:20909 次

实在没办法,binlog日志无法解析出来!
[root@localhost 123]# mysqlbinlog mysql-bin.000227 > 1.sql
ERROR: Error in Log_event::read_log_event(): 'Event too big', data_len: -1291845632, event_type: 1
ERROR: Could not read entry at offset 106: Error in log format or read error.

[root@localhost 123]# mysqlbinlog --version
mysqlbinlog Ver 3.3 for unknown-linux-gnu at x86_64

[root@localhost 123]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.34-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+------------+
| version() |
+------------+
| 5.1.34-log | 
+------------+
1 row in set (0.00 sec)

mysql> show binlog events;
+------------------+-----+-------------+-----------+-------------+--------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----+-------------+-----------+-------------+--------------------------------------------------------------+
| mysql-bin.000001 | 4 | Format_desc | 1 | 106 | Server ver: 5.1.34-log, Binlog ver: 4 | 
| mysql-bin.000001 | 106 | Query | 1 | 297 | GRANT SELECT,RELOAD,PROCESS,FILE,SUPER,REPLICATION CLIENT,LOCK TABLES on *.* to 'backup'@'localhost' identified by 'xxxxxxxx'| 
| mysql-bin.000001 | 297 | Rotate | 1 | 340 | mysql-bin.000002;pos=4 | 
+------------------+-----+-------------+-----------+-------------+--------------------------------------------------------------+
尝试过的方法:

1.网上查资料说是版本问题,但我这个mysqlbinlog文件为二进制编译安装时候生成的mysqlbinlog文件,而且环境变量也没问题。确认了不是版本问题。
2.该服务器没有做主从。
3.把该mysql-bin.000227 文件或者其他任何一个mysql-bin.xxxxx文件在该机器上或拿到其他服务器上也是安装相同版本的mysql都是报相同的错(见红色部分)。

请各位大牛们帮忙处理一下!小弟在这里先谢了!

------解决方案--------------------
或者调大一下你的 max_allowed_packet 再试试。
------解决方案--------------------
max_allowed_packet 设置的是多大? 修改大一点试下呢?


mysql log_event.cc 源码中有:
00708 #ifndef max_allowed_packet
00709 THD *thd=current_thd;
00710 uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
00711 #endif
00712 
00713 if (data_len > max_allowed_packet)
00714 {
00715 error = "Event too big";
00716 goto err;
00717 }

我也网上翻的,没试过,可以尝试一下。