How to Fix MySQL Error 1806 (ER_SLAVE_SILENT_RETRY_TRANSACTION)

Published
Length
3 min read

Luis Felipe Dias

All posts

Database replicas trigger mysql error 1806 when a worker thread must rerun a blocked transaction. You fix this issue by clearing lock waits on the replica and tuning retry limits. MySQL labels this event with symbol ER_SLAVE_SILENT_RETRY_TRANSACTION and SQLSTATE HY000. The official message states that the slave must silently retry the current transaction. In most cases, this code acts as an internal signal rather than a fatal crash. It only becomes a problem when the replica runs out of retry a

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.

Database replicas trigger mysql error 1806 when a worker thread must rerun a blocked transaction. You fix this issue by clearing lock waits on the replica and tuning retry limits.

MySQL labels this event with symbol ER_SLAVE_SILENT_RETRY_TRANSACTION and SQLSTATE HY000. The official message states that the slave must silently retry the current transaction. In most cases, this code acts as an internal signal rather than a fatal crash. It only becomes a problem when the replica runs out of retry attempts and stops.

Root causes of mysql error 1806 in database replicas

Replication worker threads read change events from the primary server and apply them in order. Sometimes, two events or a local read query fight for the same row lock. When a deadlock or lock timeout occurs, the storage engine rolls back the replica transaction. The engine then raises mysql error 1806 to tell the worker thread to try again.

Multi-threaded replication makes this event much more common in busy clusters. Multiple worker threads apply transactions at the same time to keep lag low. If a later transaction grabs a lock before an earlier one, the replica pauses. The engine kills the blocking worker so the older transaction can finish first. The stopped worker receives this error code and repeats its work without making log noise.

Long analytical queries on the replica also cause this problem. A heavy report on the replica can hold metadata locks or shared row locks. When the replication thread tries to change those same rows, it hits a wall. If the local query holds the lock too long, the replica uses up all retries. Once retry counts hit the limit, the replication thread stops and replication lag grows fast.

How to diagnose and fix replication retry failures

Start your check by reading the replica status report and the server error log. Look for recent lock wait timeouts or deadlocks that happened right before the thread stopped. Check the active process list on the replica to spot long read queries. If an app or team member is running a big export, kill that query first.

Next, check how the replica handles parallel worker threads. If workers clash often, you can switch the commit order rule to preserve strict order. You can also increase the transaction retry count so workers survive brief lock spikes. Do not set the retry count too high, or you will hide real lock bugs.

MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Never fix replication stops by telling the server to skip the failing transaction. Skipping events causes data drift between your primary database and your replica nodes. Instead, clear the blocking lock and restart the replication thread so it applies every change. Move heavy reporting apps to a dedicated read node to protect your main failover replica.

Preventing lock clashes on production replicas

Good access habits stop most replica lock fights before they start. Give human users and reporting tools read-only roles on all replica servers. No user or app should ever write data directly to a replica node. Direct writes create row conflicts and break replication threads right away.

Set query timeouts on replica sessions so stray analytical reads cannot hold locks for hours. You should also mask sensitive fields like emails, phone numbers, card numbers, and national IDs. Masking rewrites matched fields in results when engineers run diagnostic checks on live servers. This lets your team inspect lock state and fix lag while keeping private data safe.

Add wire guardrails and masking beside MySQL

Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.

With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.

Frequently asked questions

Does mysql error 1806 mean my replica database is corrupt?

No, this error code does not mean your database files or tables have corruption. It is an internal signal that tells the replication worker to rerun a blocked transaction. Your data stays safe because the storage engine rolls back the incomplete change before retrying.

Why did replication stop if the retry is supposed to be silent?

The replica retries the transaction in the background up to the configured retry limit. If the blocking lock stays in place across every attempt, the worker gives up. At that point, the server logs the error and stops the SQL thread to protect data.

Can I fix this error by skipping the blocked transaction?

You should never skip transactions to clear a lock or retry failure on a replica. Skipping a change makes the replica data different from the primary server data. Clear the blocking query and restart replication so the node runs the exact same transaction.

The query runs. The emails stay hidden.