MySQL failure--mysqlbinlog Unable to query log problem description

Source: Internet
Author: User
Tags mysql create mysql version readline

Problem Description:

Download binlog log

Mysqlbinlog mysq-bin.000285 error when viewing Binlog log

Error:error in Log_event::read_log_event (): ' Sanity check failed ', data_len:73, event_type:30

Error:could not read entry at offset 240:error in log format or read Error.

Comments:

because the version of the Mysqlbinlog tool is incompatible with the MySQL database version, or the MySQL database version is too low

View The version of the next Mysqlbinlog

Mysqlbinlog-v

Mysqlbinlog Ver 3.3 for Linux at x86_64

View The version of MySQL below

Mysql-v

MySQL Ver 14.14 distrib 5.1.73, for Redhat-linux-gnu (x86_64) using ReadLine 5.1

we see the MySQL database version is 5.1, and the Mysqlbinlog version is 3.3, can infer that the MySQL database version is too low to cause the Mysqlbinlog command is not available

Problem solving:

upgrading MySQL Database

Upgrade Version: MySQL version: mysql-5.6.10

MySQL installation directory:/usr/local/mysql

MySQL Database storage directory:/data/mysql

First, download the source package

1. Download MySQL source code

wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.10.tar.gz

2. Download CMake Source code

Wget http://www.cmake.org/files/v2.8/cmake-2.8.10.tar.gz

Second, install the compilation tool and the dependent package

Yum-y install make CMake gcc gcc-c++-* libtool ncurses-devel glibc glib2-devel openssl-devel pcre-devel bzip2-devel perl- Devel

third, installation CMake

Cd/data/packages/into the package storage directory

Tar-xvzf cmake-2.8.10.tar.gz

CD cmake-2.8.10

./configure

Make

Make install

iv. installation of MySQL

Groupadd MySQL add MySQL group

useradd-g mysql mysql create MySQL user and join to MySQL Group

Mkdir-p/data/mysql Create MySQL database storage directory

Chown-r mysql:mysql/data/mysql set the MySQL database to store directory permissions

Mkdir-p/usr/local/mysql create MySQL installation directory

Cd/data/packages/into the package storage directory

Tar-xvzf mysql-5.6.10.tar.gz extract MySQL source package

CD mysql-5.6.10 switch to the decompression directory

CMake. -DCMAKE_INSTALL_PREFIX=/USR/LOCAL/MYSQL-DMYSQL_DATADIR=/DATA/MYSQL-DSYSCONFDIR=/ETC Detection Environment

Make compilation

Make install Installation

RM-RF/ETC/MY.CNF Delete the system default configuration file

Cd/usr/local/mysql into MySQL installation directory

./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql generate MySQL system database

Ln-s/usr/local/mysql/my.cnf/etc/my.cnf Adding a soft connection

CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD adding MySQL to the system boot

chmod 755/etc/init.d/mysqld Add Execute Permissions

Chkconfig mysqld on join to boot

Vim/etc/rc.d/init.d/mysqld

Modify in this file

Basedir=/usr/local/mysql MySQL Program installation directory

Datadir=/data/mysql MySQL Database storage path

V. Start the database

Service mysqld Start

Vi. Adding the MySQL service to the system environment variables

Vim/etc/profile

Add the following line at the end of the file

Export path= $PATH:/usr/local/mysql/bin

vi. setting the MySQL database password

Enter the database

/usr/local/mysql/bin/mysql

SET PASSWORD = PASSWORD ("NewPassword");

Flush privileges;

Seven, restart the database

Service mysqld Restart

Eight, continue to query Binlog

command Line input Mysqbinlog mysql-bin.00020845

Discover or not view

ix. viewing MySQL database version information

Command Line Input

Mysql-v

MySQL Ver 14.14 distrib 5.1.73, for Redhat-linux-gnu (x86_64) using ReadLine 5.1

The database version has not changed, or the 5.1 version

go to the database to view MySQL version

/usr/local/mysql/bin/mysql-uroot-p Password

Mysql> select version ();

+-----------+

| Version () |

+-----------+

| 5.6.10 |

+-----------+

1 row in Set (0.00 sec)

Mysql>

database version is mysql-5.6.10

Perform the following actions

Cp/usr/local/mysql/bin/mysql/usr/bin/mysql

View the database version again

Mysql-v

MySQL Ver 14.14 distrib 5.6.10, for Linux (x86_64) using Editline Wrapper

version has been updated to mysql-5.6.10

Query Binlog again

Mysqlbinlog mysql-bin.0003325

Find or Error

Perform the following actions

Cp/usr/local/mysql/bin/mysqlbinlog/usr/bin/mysqlbinlog

check Binlog again when you are finished

Mysqbinlog mysql-bin.00032545

Discovery Query Succeeded

MySQL failure--mysqlbinlog Unable to query log problem description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.