How to Fix MySQL Error 4013 (ER_CANT_USE_ANONYMOUS_TO_GTID_WITH_GTID_MODE_NOT_ON)

Published
Length
3 min read

Luis Felipe Dias

All posts

You trigger mysql error 4013 when a replica converts anonymous events without full global transaction IDs enabled. To fix it, you must enable full transaction ID mode on the replica before starting replication. Database teams often see this problem when moving legacy databases to modern servers. A source server may still write events without global identifiers. The replica wants to assign new identifiers to these incoming events. Still, the replica engine blocks the start if its own transaction

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 4013 when a replica converts anonymous events without full global transaction IDs enabled. To fix it, you must enable full transaction ID mode on the replica before starting replication.

Database teams often see this problem when moving legacy databases to modern servers. A source server may still write events without global identifiers. The replica wants to assign new identifiers to these incoming events. Still, the replica engine blocks the start if its own transaction mode is off.

What causes mysql error 4013 in replication

The MySQL engine tracks this issue using the symbol ER_CANT_USE_ANONYMOUS_TO_GTID_WITH_GTID_MODE_NOT_ON and SQLSTATE HY000. The alert states that replication cannot start with local or custom UUID assignment active. This happens because the server does not have the global transaction mode fully turned on.

In a standard setup, a source database logs every change. Older systems log these changes as anonymous events linked only to log file positions. Newer systems use global transaction identifiers to track every change across the whole cluster. When you bridge an old source to a new replica, the replica can convert those events.

To do this conversion, the replica generates a fresh identifier for each incoming anonymous change. It uses either its own local server UUID or a custom UUID you choose. Still, the engine cannot write these new identifiers unless its global mode is fully active. If the mode is off or permissive, the database stops replication right away.

How to diagnose and fix the replication settings

First, check the current transaction identifier mode on the replica server. You can read the global system state to see if the mode is off. Next, check the replication channel details to see how the channel handles anonymous changes. These two settings must match before the worker threads can run.

You have two safe ways to fix this failure in a live system. The best fix is to step the replica up to full global transaction mode. MySQL requires you to move through intermediate permissive states one step at a time. Once the global mode is fully on, the channel can assign identifiers and start.

Single Sign-On (SSO) + MySQL Access Governance: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

The second option is to turn off anonymous event conversion on the replication channel. Do this if you want to keep using simple log file positions for now. Update the channel rule so it stops assigning identifiers to incoming events. Then start the replication threads again and check the replica status.

How to prevent replication state drift in production

Replication errors often happen when engineers change server rules by hand during an outage. One admin might update a channel rule while another changes a global variable. Without strict controls, these conflicting edits break replication across the cluster.

Teams should restrict who can run admin commands on production database nodes. Read checks can keeps the session active for support staff, while state changes need peer review. You should also log every admin query with the user identity attached. Clear logs help your team spot which change caused a replication stop.

During checks, protect sensitive user data in your diagnostic results. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results. This lets engineers check database state and fix replication without exposing private records.

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

Does this error harm data on the source or replica server?

No, this error only stops the replication channel from starting on the replica. Your source data stays safe, and the replica waits until you fix the mode.

Can I jump straight from off mode to on mode in MySQL?

No, the database engine requires you to step through the two permissive modes first. This step-by-step path keeps ongoing transactions safe while the server updates its state.

Should I use a local UUID or a custom UUID for converted events?

Use a custom UUID that matches the source server if you want to group source events. Use the local replica UUID if the replica acts as a brand new source.

The query runs. The emails stay hidden.