How to Fix MySQL Error 1885 (ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER)
You see mysql error 1885 when a replica holds more transaction IDs than the source server. To fix it, you must align the transaction history or rebuild the replica from a fresh backup. This problem stops data sync right away. The database engine blocks the thread to protect your data from getting corrupted. You need a clear plan to check the logs and fix the mismatch. What causes mysql error 1885 in your database cluster MySQL uses global transaction identifiers, or GTIDs, to track every cha
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You see mysql error 1885 when a replica holds more transaction IDs than the source server. To fix it, you must align the transaction history or rebuild the replica from a fresh backup.
This problem stops data sync right away. The database engine blocks the thread to protect your data from getting corrupted. You need a clear plan to check the logs and fix the mismatch.
What causes mysql error 1885 in your database cluster
MySQL uses global transaction identifiers, or GTIDs, to track every change. Each server has a unique server UUID. When the source server makes a change, it tags the event with its own UUID.
The replica reads these events and saves them in its own log. Error 1885 maps to the symbol ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER and SQLSTATE HY000. The replica has extra GTIDs stamped with the source server's UUID.
This state happens after a sudden power loss or disk crash on the source server. If the source does not flush binary logs to disk before crashing, those latest records vanish. The source already sent those changes to the replica over the network before the crash.
When the source boots back up, its log ends earlier than the replica's log. The replica asks for the next transaction, which the source no longer knows about. Relaxing durability settings for speed makes this failure happen more often during outages.
How to diagnose the transaction mismatch safely
Start by checking the sync status on both database nodes. Do not grant full admin rights to every engineer on the team. Use a read-only role to view the executed GTID sets on the source and the replica.
Compare the ranges linked to the source server's UUID. You will see a higher number on the replica than on the source. Next, inspect the relay logs on the replica to see what those extra changes actually did.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
This check tells you if the replica holds real user data that the source lost. Keep safety checks turned on while you read these logs. Never skip transactions blindly just to make the error go away.
How to fix the replica and restore data sync
You have two safe ways to fix this issue in a live system. The best choice depends on whether you want to keep those extra changes on the replica.
If the replica has valid data that the source lost during a crash, promote the replica. Make the replica the new source server so you do not lose recent writes. Then, rebuild the old source server as a fresh replica from a clean backup.
Sometimes those extra transactions on the replica are just test runs or bad writes. In that case, the source server holds the true state of your data. You should wipe the broken replica and restore it from a new snapshot of the source.
To prevent this issue in the future, set your source server to flush logs on every commit. This rule keeps the disk log in step with network sends during a crash. Also, restrict write permissions on replicas so users cannot inject rogue transactions.
Inspect every MySQL query and response in flight
Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.
First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.
Frequently asked questions
Can I fix mysql error 1885 by injecting empty transactions?
Injecting empty transactions on the source will clear the error, but it hides missing data. Only use empty transactions if you proved the missing changes were not needed.
Does turning off GTID mode solve this sync failure?
Switching to file position sync skips the UUID check, but your data stays out of sync. You still need to fix the missing rows between the two servers.
How do I stop this error from happening after a source crash?
Set your database to sync binary logs to disk after every single transaction commit. This setting stops the source from sending changes to replicas before saving them locally.
Related guides
In this post