MySQL read_log_event(): 'Found invalid event in binary log'

MySQL以简单易用著称,在同一个服务器上可以安装N个不同的版本,方便测试,迁移等等。此外,对于大多数Linux系统,集成了mysql,缺省会被安装。因此多版本的问题导致一些莫名的错误也是时有发生。最近在提取binlog日志时,碰到了一个read_log_event,Found invalid event in binary log。经查发现原来是mysqlbinlog版本问题引发的。如下文,供大家参考。

1、故障描述
[[email protected] bak]# mysqlbinlog --start-datetime="2014-12-15 00:30:00" mysql-bin.000399bk |more
ERROR: Error in Log_event::read_log_event(): ‘Found invalid event in binary log‘, data_len: 376, event_type: 19
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @[email protected]@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#141213 21:05:01 server id 11  end_log_pos 120  Start: binlog v 4, server v 5.6.12-log created 141213 21:05:01
# Warning: this binlog is either in use or was not closed properly.
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET [email protected]_COMPLETION_TYPE*/;

2、故障分析与解决
#查看当前是哪一个mysqlbinlog文件
[[email protected] bak]# which mysqlbinlog
/usr/bin/mysqlbinlog

#查看mysqlbinlog的版本,此时为3.2
[[email protected] bak]# mysqlbinlog --version
mysqlbinlog Ver 3.2 for redhat-linux-gnu at x86_64
#Author : Leshami
#Blog   : http://blog.csdn.net/leshami

[[email protected] bak]# whereis mysqlbinlog
mysqlbinlog: /usr/bin/mysqlbinlog /usr/share/man/man1/mysqlbinlog.1.gz

#此服务器的安装路径其实质如为/app/soft/mysql/,查看mysqlbinlog的版本为3.4版
[[email protected] bak]# /app/soft/mysql/bin/mysqlbinlog --version
/app/soft/mysql/bin/mysqlbinlog Ver 3.4 for Linux at x86_64

#下面使用正确路径的mysqlbinlog,此时成功
[[email protected] bak]# /app/soft/mysql/bin/mysqlbinlog --start-datetime="2014-12-15 00:30:00" mysql-bin.000399bk |more
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @[email protected]@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#141213 21:05:01 server id 11  end_log_pos 120 CRC32 0xaafb2293         Start: binlog v 4, server v 5.6.12-log created 141213 21:05:01
# Warning: this binlog is either in use or was not closed properly.
BINLOG ‘
fTmMVA8LAAAAdAAAAHgAAAABAAQANS42LjEyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAZMi
+6o=
‘/*!*/;
# at 594054457

#查看当前系统mysql的版本
# /app/soft/mysql/bin/mysql --version
/app/soft/mysql/bin/mysql  Ver 14.14 Distrib 5.6.12, for Linux (x86_64) using  EditLine wrapper

#以下的为OS安装时缺省安装的版本
# rpm -qa |grep -i mysql
mysql-5.0.95-3.el5

3、小结
a、对于生产环境mysql的部署,建议在安装OS前不安装缺省的mysql或者安装后卸载缺省的mysql
b、因需要存在多版本的情形,应考虑使用直接路径方式来执行相应的mysql命令行工具

MySQL read_log_event(): 'Found invalid event in binary log'

时间: 2024-10-09 12:38:19

MySQL read_log_event(): 'Found invalid event in binary log'的相关文章

mysql从库Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'报错处理

年后回来查看mysql运行状况与备份情况,登录mysql从库查看主从同步状态 1 mysql> show slave status\G; 2 *************************** 1. row *************************** 3 Slave_IO_State: 4 Master_Host: 101.200.*.* 5 Master_User: backup 6 Master_Port: 3306 7 Connect_Retry: 60 8 Master_

MySQL学习笔记06基于Binary Log的复制

1.1.1. 相关概念 (1)Binary Log 当变量log_bin的值为ON时,MySQL将启用Binary Log,这将在data目录下产生类似mysql-bin.00001, mysql-bin.00002的二进制日志文件,这些文件记录了数据库中执行的各种操作. binlog_format变量指定了MySQL的二进制日志的格式,支持三种类型的格式: ROW       使用数据表的行记录来记录日志.优点是避免了STATEMENT格式时SQL语句中自增字段的不良影响.缺点时一条更新大量记

清除mysql binary log

作为一个oracle dba有时候不得不管理一下mysql数据库,当为主从库时需要阶段性清理mysql binary log,清楚方式如下: 首先查看mysql 的当前日志组 show master status; 确定当前日志组后删除日志文件 purge binary logs to 'mysql-bin.000795'; 删除000795之前的日志 清除mysql binary log,布布扣,bubuko.com

MySQL二进制日志(binary log)总结

本文出处:http://www.cnblogs.com/wy123/p/7182356.html (保留出处并非什么原创作品权利,本人拙作还远远达不到,仅仅是为了链接到原文,因为后续对可能存在的一些错误进行修正或补充,无他) 今天无意中发现了一个云栖社区举行的MySQL“第一季:挑战玄惭之 慢SQL性能优化赛”,在测试服务器上执行其测试脚本写入数据的时候报错提示如下,Multi-statement transaction required more than 'max_binlog_cache_

MySQL 5.7 开启binary log(binlog)及注意事项

二进制日志语句Binary Log ,我们俗称binlog,记录数据库更改的数据,常用于主从复制环境和恢复 备份. 开启binlog比较简单,Centos7环境打开my.cnf配置文件,添加 server-id = [序列号] log-bin = [文件名] 5.7.3以后版本必须配置server-id,文件名可配置绝对路径,即可开启binlog. binlog配置有几个特殊点,需要注意 1,文件名如果是绝对路径,在这种情况下,索引必须是手动编辑,即在my.cnf配置文件添加 log-bin-i

MySQL 二进制日志(Binary Log)

同大多数关系型数据库一样,日志文件是MySQL数据库的重要组成部分.MySQL有几种不同的日志文件,通常包括错误日志文件,二进制日志,通用日志,慢查询日志,等等.这些日志可以帮助我们定位mysqld内部发生的事件,数据库性能故障,记录数据的变更历史,用户恢复数据库等等.二进制日志,也叫binary log,是MySQL Server中最为重要的日志之一,本文主要描述二进制日志. 1.MySQL日志文件系统的组成   a.错误日志:记录启动.运行或停止mysqld时出现的问题.   b.通用日志:

MySQL schema和binary log磁盘空间趋势分析

Author:Skate Time:2015/01/05 MySQL schema和binary log磁盘空间趋势分析 [[email protected] dist]# ./mysqlsize  --help usage: Database diskspace usage v0.1 ,(C) Copyright Skate 2014 [-h] [--load LOAD] --dbtype DBTYPE --cfg CFG --field FIELD --datadir DATADIR --l

mysql 主从 Got fatal error 1236 from master when reading data from binary log: 'Could not find first 错误

本地MySQL环境,是两台MySQL做M-M复制.今天发现错误信息: mysql 5.5.28-log> show slave status\G *************************** 1. row ***************************                Slave_IO_State:                   Master_Host: 88.88.88.88                   Master_User: replicate

MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT...

1:错误日志大量错误 150602 14:40:02 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT