[RHEL5] Invalid MySQL binary log is generated

Solution Verified - Updated -

Issue

  • Can not restore normally from MySQL binary log because invalid binary log is generated.
    
  • Steps to Reproduce

       1. Enable binary log option
    
         ---- /etc/my.cnf ----
         [mysqld]
         log-bin
         ---------------------
    
       2. Start mysql server
    
         # /etc/init.d/mysqld start
    
       3. Run mysql command
    
         # mysql -u root test < issue.sql
    
       4. Run mysqladmin command
    
         # mysqladmin flush-logs
    
       5. Run php srcript 
    
         # php issue.php
    
       6. Confirm value of serial table
    
         # mysql test
         mysql> select * from serial;
         +----+--------+------------+
         | id | active | utime      |
         +----+--------+------------+
         |  1 |      0 | 1271842640 | 
         +----+--------+------------+
         1 row in set (0.00 sec)
         mysql> quit
    
       7. Restore serial table from binary log
    
         # mysqladmin flush-logs
         # lsof | grep mysqld-bin.00
         mysqld    4759 mysql   11w      REG      253,0       98    663144 /var/lib/mysql/mysqld-bin.000003
         # php issue.php
         # mysqlbinlog --disable-log-bin /var/lib/mysql/mysqld-bin.000003 > mysql-dump.sql
         # mysql -u root test < mysql-dump.sql
    
       8. Confirm value of serial table again
    
         # mysql test
         mysql> select * from serial;
    
       Observed behavior:
    
         mysql> select * from serial;
         +----+--------+------------+
         | id | active | utime      |
         +----+--------+------------+
         |  1 |     48 | 2147483647 | 
         +----+--------+------------+
         1 row in set (0.01 sec)
    
       Desired behavior:
    
         mysql> select * from serial;
         +----+--------+------------+
         | id | active | utime      |
         +----+--------+------------+
         |  1 |      0 | 1271842640 | 
         +----+--------+------------+
         1 row in set (0.00 sec)
    

Environment

  • Red Hat Enterprise Linux 5
  • mysql-server-5.0.77-3.el5 and later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content