Home  >  Article  >  Database  >  Detailed explanation of mysql using row format binlog undo operation

Detailed explanation of mysql using row format binlog undo operation

小云云
小云云Original
2017-12-13 13:49:392115browse

When MySQL uses the row format and uses the default binlog_row_image=full, the complete data image before and after the update is recorded in the binlog. Therefore, it is feasible to perform undo operations based on row format binlog. This article mainly introduces the example of mysql using row format binlog undo operation. I hope it will be helpful to you.

[GitHub Page] [linux binaries]

For example

./binlog_undo -f /data/mysql/log-bin.000004 -p 3958 - o binlog.out
will scan all transactions from position 3958 to the end of /data/mysql/log-bin.000004, reverse the order of all transactions and the order of statements in each transaction, and reverse all operations. WRITE and DELETE are reversed, the before and after images of UPDATE are swapped, and then the generated binlog file is written to binlog.out. You can then use the mysqlbinlog tool to play back the binlog to undo the operation.

This tool can be used to undo operations on the original master that are not synchronized to the backup after a master-slave switchover to avoid complete reconstruction; it can also be used as a regret medicine for misoperations.

Related recommendations:

MySQL method of creating users, authorizing and revoking user permissions

Detailed introduction to mysql5.7 creating users, authorizing deleting users Sample code for revocation of authorization

The difference between revocation of object permissions and system permissions in Oracle PL/SQL

The above is the detailed content of Detailed explanation of mysql using row format binlog undo operation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn