Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the problems that should be paid attention to when recovering data by mysqlbinlog command?

Shulou Source: shulou.com Published: 2022-05-31 15:47:25 10月03日 Update

This article will explain in detail what you should pay attention to about the mysqlbinlog command to recover data. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Do not use the base64-output=decode-rows parameter

-- base64-output=decode-rows is mainly used when parsing or viewing ROW-level binlog logs. Do not use this parameter when performing SQL.

For example:

/ usr/local/mysql-8.0.13/bin/mysqlbinlog mysql-bin.000004 | mysql- uroot-pendant 123456'

Or

/ usr/local/mysql-8.0.13/bin/mysqlbinlog mysql-bin.000004 > / tmp/rollback.sql

Mysql-uroot-pendant 123456'

< /tmp/rollback.sql 2.是否应该使用--skip-gtids=true参数 第一种情况: 如果我们是要恢复数据到源数据库或者和源数据库有相同 GTID 信息的实例,那么就要使用该参数。如果不带该参数的话,是无法恢复成功的。 # /usr/local/mysql-8.0.13/bin/mysqlbinlog --skip-gtids=true mysql-bin.000001 |mysql -uroot -p 或者 # /usr/local/mysql-8.0.13/bin/mysqlbinlog --skip-gtids=true mysql-bin.000001 >

Rollback.sql

Mysql-uroot-pendant 123456' < rollback.sql

The second situation:

If you are restoring to the database of another instance and do not contain the GTID information of the source instance, you can recover successfully with or without using this parameter.

This is the end of the article on "what should be paid attention to in mysqlbinlog command data recovery". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Data parameters instance database article command question success information situation more good practical same content article log knowledge level reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB Xiaomi MySQL Microsoft