3 common errors in reading MySQL Binlog logs

3 common errors in reading MySQL Binlog logs

1. mysqlbinlog: [ERROR] unknown variable 'default-character-set=utf8mb4'

When we add the default-character-set=utf8mb4 option in my.cnf, an error will be reported when viewing binlog in mysqlbinlog.

Solution: Add the --no-defaults option after .mysqlbinlog

For example:

mysql bin executable file path /bin/mysqlbinlog --no-defaults binlog directory /mysql_bin.000005

2.ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

Use mysqldump to export data and migrate the database. When migrating in, the above error was reported.

The reason for the query is: the current GTID_EXECUTED parameter already has a value, and the dump file from the source database contains the SET @@GLOBAL.GTID_PURGED operation

Solution:

Method 1: reset mater

This operation can clear the GTID_EXECUTED value of the current library

Method 2: --set-gtid-purged=off

When dumping, add the --set-gtid-purged=off parameter to avoid exporting gtid information.

mysqldump --set-gtid-purged=off -d dbtest > dbtest.sql

3.ERROR 1782 (HY000) at line 23: @@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON.

When we use the mysqlbinlog tool to specify --stop-position and --start-position for recovery (partial recovery), an error is reported.

For example, the data in binlog is as follows:

When we select the starting point corresponding to Query (713) instead of the Pos corresponding to Gtid (648), an error will be reported.

The following writing error:

Installation path/ bin/mysqlbinlog --no-defaults --start-position=713 --stop-position=1646

The following writing does not report an error:

Installation path /bin/mysqlbinlog --no-defaults --start-position=648 --stop-position=1646 .........

Summarize

The above are the three common errors in reading MySQL Binlog logs that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed explanation of MySQL database binlog cleanup command
  • How to view mysql binlog (binary log)
  • Two ways to correctly clean up mysql binlog logs
  • Explain MySQL's binlog log and how to use binlog log to recover data
  • Summary of Binlog usage of MySQL database (must read)
  • How to automatically clean up MySQL binlog logs
  • Teach you to automatically restore the log file (binlog) of the MySQL database
  • [MySQL binlog] How to thoroughly parse binlog in Mixed log format in MySQL
  • Detailed explanation of mysql binlog binary log
  • Parsing MySQL binlog

<<:  The Linux operating system uses Python to implement the visualization function of the task manager

>>:  JavaScript implements product details of e-commerce platform

Recommend

Detailed steps to modify MySQL stored procedures

Preface In actual development, business requireme...

Docker container connection implementation steps analysis

Generally speaking, after the container is starte...

Analysis of CocosCreator's new resource management system

Table of contents 1. Resources and Construction 1...

JS implements jQuery's append function

Table of contents Show Me The Code Test the effec...

JavaScript function detailed introduction

Any number of statements can be encapsulated thro...

Tutorial on how to modify the root password in MySQL 5.7

Version update, the password field in the origina...

Summary of changes in the use of axios in vue3 study notes

Table of contents 1. Basic use of axio 2. How to ...

Rounding operation of datetime field in MySQL

Table of contents Preface 1. Background 2. Simula...

Tomcat CentOS installation process diagram

Tomcat CentOS Installation This installation tuto...

Detailed explanation of Javascript closures and applications

Table of contents Preface 1. What is a closure? 1...

Axios cancels repeated requests

Table of contents Preface 1. How to cancel a requ...

Initial summary of the beginner's website building tutorial

After writing these six articles, I started to fee...

Solution for Baidu site search not supporting https (tested)

Recently, https has been enabled on the mobile ph...