How to Fix MySQL Error 4072 (ER_WARN_C_DISABLE_GTID_ONLY_WITH_SOURCE_AUTO_POS_INVALID_POS)
You trigger mysql error 4072 when you turn off GTID-only mode on a replication channel. You fix it by syncing fresh binary log file positions from the source server first. This message has the SQLSTATE code HY000 and warns about stale replication positions on the channel. When a replica uses GTID-only mode, it stops writing exact file names and byte offsets to disk. Turning off that mode while keeping auto-positioning active leaves the replica with old file tracking data. Understanding how the
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 trigger mysql error 4072 when you turn off GTID-only mode on a replication channel. You fix it by syncing fresh binary log file positions from the source server first.
This message has the SQLSTATE code HY000 and warns about stale replication positions on the channel. When a replica uses GTID-only mode, it stops writing exact file names and byte offsets to disk. Turning off that mode while keeping auto-positioning active leaves the replica with old file tracking data. Understanding how the database tracks transactions helps you clear this warning without losing data.
What causes mysql error 4072 in replication channels
MySQL replication uses two main ways to track data changes from a source to a replica. The older method tracks exact binary log file names and byte positions on the source server. The newer method uses global transaction identifiers, which we call GTIDs, to track each data change.
When you enable GTID-only mode on a channel, the replica stops saving file and byte positions. This reduces disk writes on the replica because it only records the transaction ID sets. The database skips updating the binary log file coordinates in its internal tracking tables.
Over time, the saved file name and byte offset fall far behind the real source state. If an admin turns off GTID-only mode later, the database checks those saved file coordinates. Even with auto-positioning turned on, the replica notices that its stored file positions are out of date. The engine then raises mysql error 4072 to warn you that the channel positions are invalid.
How to diagnose the channel state safely
Before you change any replication rules, you must check the current state of the replica channel. Have an authorized operator log in with a read-only diagnostic role to check replication status. Do not grant full admin rights to routine users just to inspect channel health.
Look at the replication channel status report to see the current GTID sets and file positions. Check if the receiver thread and the applier thread are both running without delay. Compare the executed transaction set on the replica with the available transaction set on the source.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You should also check the error log on the replica to see which channel triggered the warning. If your team runs multiple channels, find the exact channel name listed in the warning message. Keep data safety controls active while you read these system status tables.
How to fix stale replication positions in production
To resolve the warning, you need to help the replica refresh its saved binary log coordinates. First, plan your maintenance window so you do not disrupt active read traffic on the replica. Make sure the replica has caught up with the source server before you stop the channel.
Next, stop the replication threads on the target channel using a role with replication admin permissions. Once the threads stop, change the channel settings to turn off the GTID-only option. Keep the source auto-positioning setting active so the replica still pairs transactions by their ID.
Start the replication threads again and watch the channel status report. When the applier processes the next transaction, the replica writes the current binary log file position. This action replaces the stale file coordinates with valid ones and clears the warning condition.
If you later decide to turn off auto-positioning too, the replica now has valid file coordinates. Never turn off both GTID-only mode and auto-positioning at the exact same time. Doing both at once forces the replica to read from the old, invalid file position. Always let the channel run with auto-positioning first so it can record a fresh byte offset.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
Does mysql error 4072 stop replication right away?
No, this code acts as a warning when you keep source auto-positioning turned on. Replication continues using transaction IDs, and the next applied event updates the stale file position.
What happens if I disable auto-positioning while positions are invalid?
If you disable auto-positioning while file coordinates are stale, the replica tries to read old logs. This mistake causes replication to fail or creates duplicate data errors on the replica.
How can teams prevent unauthorized changes to replication channels?
Limit replication admin permissions to specific maintenance roles and require approval before running channel changes. Separate everyday diagnostic read roles from the roles that can stop or alter replication threads.
Related guides
In this post