Common SQL Errors

MySQL Error 1843: ER_GTID_EXECUTED_WAS_CHANGED - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>The server detected that the @@GLOBAL.GTID_EXECUTED value was unexpectedly modified, signaling possible replication drift or manual tampering.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error code 1843?

<p>MySQL Error 1843 ER_GTID_EXECUTED_WAS_CHANGED occurs when the GTID set stored in @@GLOBAL.GTID_EXECUTED is altered during runtime, breaking replication consistency. Restore the correct GTID set or restart the server with proper replication settings to resolve the issue.</p>

Error Highlights

Typical Error Message

@@GLOBAL.GTID_EXECUTED was changed from '%s' to '%s'.

Error Type

Replication Error

Language

MySQL

Symbol

ER_GTID_EXECUTED_WAS_CHANGED

Error Code

1843

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1843 ER_GTID_EXECUTED_WAS_CHANGED?

The exact message is: @@GLOBAL.GTID_EXECUTED was changed from '%s' to '%s'. The server raises it when the GTID set tracking executed transactions suddenly shifts while MySQL is running.

GTIDs guarantee that every transaction is uniquely identified across the replication topology. If the executed set jumps, slaves can no longer determine which events are missing or duplicated.

When Does This Error Appear?

The error surfaces during replication startup, binary log rotation, or any internal consistency check that reads @@GLOBAL.GTID_EXECUTED after an unexpected update.

It is common after manual UPDATE statements on mysql.gtid_executed or third-party tools that incorrectly edit relay logs.

What Causes This Error?

Most cases trace back to human actions: restoring snapshots, importing dumps, or using SET GLOBAL GTID_PURGED without restarting the server.

It can also result from bugs in earlier MySQL 5.6/5.7 releases that double-apply GTID sets during crash recovery.

How to Fix MySQL Error 1843

First, stop replication threads to prevent further divergence. Capture the current GTID_EXECUTED value for auditing.

Next, decide on the authoritative GTID set. You can reset it with RESET MASTER or reset slave positions with RESET SLAVE ALL, then re-seed data from a healthy source.

Common Scenarios and Solutions

If a backup restore caused the error, re-import with --set-gtid-purged=OFF so GTIDs are not rewritten.

If only one server is affected, use CHANGE MASTER TO ... MASTER_AUTO_POSITION=1 and start replication from a clean snapshot.

Best Practices to Avoid This Error

Never modify mysql.gtid_executed manually in production. Always perform GTID_PURGED operations while the server is offline.

Automate backups and restores with mysqldump or MySQL Shell, and validate GTID consistency before promotion.

Related Errors and Solutions

Errors 1236 (binlog out of sync) and 1840 (ER_GRP_RPL_GTID_EXECUTED_WAS_CHANGED) often appear together. They share similar root causes and fixes.

Common Causes

Manual update of mysql.gtid_executed

Running UPDATE/INSERT on the internal GTID tables changes the executed set without proper logs.

Improper use of SET GLOBAL GTID_PURGED

Setting GTID_PURGED while the server is online rewrites history and confuses slaves.

Inconsistent snapshot restore

Importing a dump generated with different GTID sets inserts mismatched values.

Crash recovery bug

Older MySQL versions duplicated GTIDs after an unclean shutdown, leading to diverging sets.

Related Errors

Error 1236: Slave has retrieved binlog but it cannot pass it to SQL thread

Indicates binary log gap; often follows a GTID mismatch.

Error 1840: ER_GRP_RPL_GTID_EXECUTED_WAS_CHANGED

Group Replication variant of the same inconsistency.

Error 1872: ER_GTID_PURGED_WAS_CHANGED

Raised when GTID_PURGED is modified incorrectly.

FAQs

Is Error 1843 fatal to replication?

Yes. It halts replication until GTID sets are reconciled or logs are reset.

Can I ignore the message if my application runs?

No. Ignoring it risks silent data divergence and inconsistent reads.

Does upgrading MySQL fix the issue?

Upgrading removes known bugs but you must still reset or align GTID sets.

How does Galaxy help prevent this error?

Galaxy tracks query history and endorses safe administrative commands, reducing accidental GTID edits.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo