问题
mysqlbinlog -v -v --base64-output=DECODE-ROWS mysql-bin.000166 | less
ERROR: Error in Log_event::read_log_event(): 'Found invalid event in binary log', data_len: 111, event_type: 35
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#190408 18:15:19 server id 311948559 end_log_pos 123 CRC32 0x56e12e5d Start: binlog v 4, server v 5.7.21-log created 190408 18:15:19
# Warning: this binlog is either in use or was not closed properly.
BINLOG '
Nx+rXA8P9ZcSdwAAAHsAAAABAAQANS43LjIxLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA
AV0u4VY=
'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
查看当前使用的mysqlbinlog文件位置
which mysqlbinlog
/usr/bin/mysqlbinlog
ll /usr/bin/mysqlbinlog
-rwxr-xr-x 1 root root 3259000 6月 10 2014 /usr/bin/mysqlbinlog
该myqlbinlog在2014年就已经存在了,推测是该机器中自带的mariadb中的
版本信息
/usr/bin/mysqlbinlog --version
/usr/bin/mysqlbinlog Ver 3.3 for Linux at x86_64
/usr/bin/mysqlbinlog Ver 3.3 for Linux at x86_64
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Dumps a MySQL binary log in a format usable for viewing or for piping to
the mysql command line client.
查看当前运行的mysqld进程basedir
ps -ef | grep defaults | grep 3308 | awk '{print $8}'
/opt/mysql/base/5.7.21/bin/mysqld
版本信息
/opt/mysql/base/5.7.21/bin/mysqlbinlog -V
/opt/mysql/base/5.7.21/bin/mysqlbinlog Ver 3.4 for linux-glibc2.12 at x86_64
删除原可执行文件mysqlbinlog,重新建立软链接
rm -r /usr/bin/mysqlbinlog
rm:是否删除普通文件 "/usr/bin/mysqlbinlog"?y
ln -s /opt/mysql/base/5.7.21/bin/mysqlbinlog /usr/bin
可正常使用
mysqlbinlog -v -v --base64-output=DECODE-ROWS mysql-bin.000166 | less
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#190408 18:15:19 server id 311948559 end_log_pos 123 CRC32 0x56e12e5d Start: binlog v 4, server v 5.7.21-log created 190408 18:15:19
# Warning: this binlog is either in use or was not closed properly.
# at 123
老版本mysql可执行文件却能正常运行
ll /usr/bin/mysql
-rwxr-xr-x 1 root root 3546584 6月 10 2014 /usr/bin/mysql
mysql --version
mysql Ver 15.1 Distrib 5.5.35-MariaDB, for Linux (x86_64) using readline 5.1
/opt/mysql/base/5.7.21/bin/mysql -uroot -p --socket=/datas/mysql/data/3308/mysqld.sock -e"select version()"
Enter password:
+------------+
| version() |
+------------+
| 5.7.21-log |
+------------+
结论
出现 ERROR: Error in Log_event::read_log_event(): 'Found invalid event in binary log', data_len: 111, event_type: 35 错误是由于当前使用的myqlbinlog可执行文件的版本和正在运行的mysqld进程basedir中mysqlbinlog的版本不一致导致的(版本低不能正常读取高版本的mysqld产生的mysql-bin文件,产生的mysql-bin文件有event老版本的myqlbinlog不能正常读取)
低版本的mysql可执行文件能正常登陆高版本的mysqld