今天晚上接到现场电话,说 mysql数据库中异常丢失数据,我登陆系统使用mysqlbinlog进行分析日志
[mysql@ezgclient mysqldata]$ mysqlbinlog mysqlbin.000149>/tmp/11_25.txt
ERROR: Error inLog_event::read_log_event(): 'Found invalid event in binary log', data_len: 58, event_type: 19
发现这个错误,第一反应是我使用的mysqlbinlog的版本不正确
[mysql@ezgclient mysqldata]$ whereismysqlbinlog
mysqlbinlog: /usr/bin/mysqlbinlog
[mysql@ezgclient mysqldata]$ /usr/bin/mysqlbinlog-V
/usr/bin/mysqlbinlogVer 3.2 forredhat-linux-gnu at x86_64
[mysql@ezgclient mysqldata]$ /opt/mysql/product/5.1/bin/mysqlbinlog-V
/opt/mysql/product/5.1/bin/mysqlbinlogVer 3.3 forunknown-linux-gnu at x86_64
通过查询果然发现在默认情况下调用的是系统默认安装的mysql中的mysqlbinlog,因为这个mysqlbinlog的版本和当前的bin_log的版本不能对应起来,所以不能处理,使用对应的mysqlbinlog工作正常
[mysql@ezgclient mysqllog]$ /opt/mysql/product/5.1/bin/mysqlbinlogmysqlbin.000150>/tmp/11_25.txt
[mysql@ezgclient mysqllog]$ more/tmp/11_25.txt
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#111125 16:15:37 server id 2 end_log_pos 106 Start: binlog v 4, server v 5.1.35-log created 111125 16:15:37 at startup
# Warning: this binlog was not closed properly. Most probably mysqld crashed writing it.
ROLLBACK/*!*/;
BINLOG '
……………………………………
--转自
该贴由koei123转至本版2015-6-1 14:57:08