The "MySQL" Mysqlbinlog_flashback tool uses

Source: Internet
Author: User

Introduction:

mysqlbinlog_back.py is a tool that reads the mysqld binlog of the row format online and then generates a reverse SQL statement.
It is generally used for data recovery purposes. The so-called reverse SQL statement is if INSERT, the reverse SQL is delete.
If delete, the reverse SQL is insert, and if it is update, the reverse SQL or update, but the value of update is the original value.

This project requires installation dependencies

yum install python-pippip install pymysql

Official address: Https://github.com/58daojia-dba/mysqlbinlog_flashback

Usage Restrictions:

    • 1.mysql Binlog must be in row format.
    • 2. The reverse-generated table must have a primary key.
    • 3. Logs must be in the master inventory
    • 4. The reverse-generated MySQL data type is listed below. Types not listed are not rigorously tested and may be problematic
    • 5. Types of support
      Allow parsing of the field type, not inside the error will be
      allow_type={"varchar": true, "char": True, "datetime": True, "date": true, "time": true, "timestamp": true, "bigint": true, "Mediumint": true, "smallint": true, "tinyint": true, "int": true, "smallint": true, "decimal": true, "float": true, "double ": True," Longtext ": True," Tinytext ": True," text ": True," Mediumtext ": true}

Tool Installation:
Installation packages can be downloaded on github
Unzip directly to enter the directory as follows:

Tool use:

# 查看下参数使用说明python mysqlbinlog_back.py --help  # 回滚某个表python mysqlbinlog_back.py --host="192.168.1.60" --port=3306 --username="root" --password="yourpassword" --schema=test --tables="test_tb" -S "mysql-bin.000009"

Rollback statements are generated in the Mysqlbinlog_flashback-master/log directory when the rollback is complete
The following statements are then executed to roll back in the database

mysql -uroot -pyourpassword --default-character-set=utf8mb4 test < flashback_test_20170912_170610.sql

The "MySQL" Mysqlbinlog_flashback tool uses

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.