Tuesday, February 07, 2023

ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED

 ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED

As a MySQL 8.0 user, you may have encountered the following error message when trying to dump data from one database server and add that data to another server:

"ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED."

This error occurs when the Global Transaction Identifier (GTID) sets of the source and target servers overlap, probably from a previous import. A use case for this is importing staging into development as an example.

GTIDs are unique identifiers that are generated for each transaction in MySQL 8.0. They allow you to track changes to your data, even across multiple servers. When you receive this error message, it means that there is a conflict between the source and target server GTID sets.

The solution to this issue is to reset the master on the target server before importing the dump file. Resetting the master will erase all the binary logs and start a new one, allowing you to import the dump file without encountering the error.

  1. RESET MASTER
  2. mysql -uroot db < dump.sql

It is nice to blog again, I am blogging here about mySQL and @ https://dathan.github.io/blog/ on random other things.

No comments: