Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to read Binlog logs in MySQL

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to read the Binlog log in MySQL. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

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

When we add the default-character-set=utf8mb4 option to my.cnf, we get an error when mysqlbinlog looks at binlog.

Solution: add-- no-defaults option after .mysqlbinlog

For example:

Path where the mysqlbin executable file is located / bin/mysqlbinlog-- directory where no-defaults binlog is located / mysql_bin.000005

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

The data is exported by mysqldump and the database is migrated. When I moved in, I reported the above error.

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

Solution:

Method 1: reset mater

This operation sets the GTID_EXECUTED value of the current library to null.

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

When exporting dump, 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 are using the mysqlbinlog tool to specify-- stop-position,-- start-position for recovery (partial recovery) Times error.

For example, the data in binlog is as follows:

When the starting point we choose is Pos (713) for Query, instead of Pos (648) for Gtid, an error occurs.

The following words report an error:

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

The following words are correct:

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

After reading the above, do you have any further understanding of how to read Binlog logs in MySQL? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report