MySQL problems
MySQL Replication Stopped: What the Error Number Says, and the Fix
2 December 2026
A MySQL replica has two threads per channel. The receiver (I/O) thread fetches the source's binary log, and the applier (SQL) thread applies it. Replication stops when one of them stops, and the server keeps the error number that stopped it. That number decides the fix.
Which thread stopped, and why
Run this on the replica:
SHOW REPLICA STATUS\G
Read four pairs: Replica_IO_Running with Last_IO_Errno and Last_IO_Error, and Replica_SQL_Running with Last_SQL_Errno and Last_SQL_Error. With several appliers, the error of each worker is here:
SELECT channel_name, worker_id, last_error_number,
last_error_message, last_error_timestamp
FROM performance_schema.replication_applier_status_by_worker
WHERE last_error_number <> 0;
SELECT channel_name, service_state, last_error_number,
last_error_message, last_heartbeat_timestamp
FROM performance_schema.replication_connection_status;
The error numbers that stop replication
| Error | Thread | What it means | The fix |
|---|---|---|---|
| 1062 | Applier | Duplicate key: the row the source inserted already exists on the replica. | The replica's data drifted. Find out who wrote on the replica, compare the row, then fix it or rebuild the replica. |
| 1032 | Applier | Row not found: the row the source updated or deleted is missing on the replica. | The same drift, the other way. Restore the row from the source, or rebuild. |
| 1146, 1050, 1051 | Applier | A table is missing, or exists when it should not. | DDL ran on one side only. Make the replica's schema match the source. |
| 1236 or 13114 | Receiver | The source cannot send the binary log the replica asks for: it was purged, or the GTIDs the replica needs are gone. | The replica must be rebuilt from a copy of the source, for example with the clone plugin. |
| 2003, 2005, 2013 | Receiver | The source does not answer: network, DNS, firewall, or the source is down. | The receiver retries by itself. Fix the path; nothing is lost while the source keeps its binary logs. |
| 1045 | Receiver | Access denied for the replication user. | The password changed on one side. CHANGE REPLICATION SOURCE TO SOURCE_PASSWORD = ... |
| 2061 | Receiver | The user has caching_sha2_password and the connection is not encrypted. | Use SSL, or set GET_SOURCE_PUBLIC_KEY = 1 on the channel. |
The fix, in order
- Read before you restart.
START REPLICAwithout reading the error restarts into the same error, and the first message is overwritten. - Do not skip a 1062 or 1032 by reflex. A skipped transaction leaves the replica different from the source for good, and the next error comes from that difference. With GTIDs, skipping means committing an empty transaction with the failed GTID:
Do it only when you know the row is right on the replica.STOP REPLICA; SET GTID_NEXT = 'source_uuid:12345'; BEGIN; COMMIT; SET GTID_NEXT = 'AUTOMATIC'; START REPLICA; - Stop writes on the replica. Set
super_read_only = ONon every replica; most 1062 and 1032 errors start with a write that went to the wrong server. - Keep the binary logs longer than a replica may be down.
binlog_expire_logs_secondson the source is the longest outage a replica survives without a rebuild. - Rebuild when the data cannot be trusted.
CLONE INSTANCE FROMcopies the source in one command on MySQL 8.0.17 and later.
See it coming
Radar Engine, the detection layer of dbCove, watches every channel that was seen running, with no agent on the server:
| Detector | When it fires |
|---|---|
| Replication stopped (error) | A thread is off for 2 minutes and the server reports an error number: Critical. The finding names the channel, the thread and the error number with its meaning. |
| Replication stopped (source unreachable) | The receiver keeps reconnecting while the applier runs: Warning, Critical from 15 minutes. |
| Replication stopped (no error) | A thread is off and no error is reported, so a person probably stopped it: Warning. |
| Replication lag | Watch from 3 minutes or the channel's usual lag, Warning from 10 minutes, Critical from an hour. |
| Role changed | A server became or stopped being a replica, or read_only changed. |
Ask dbCove AI why replication stopped and it reads the channel's status, the error and the history of that replica, and proposes the fix. It changes nothing without your click.
Questions
How do I check if MySQL replication is running?
Run SHOW REPLICA STATUS on the replica. Replica_IO_Running and Replica_SQL_Running must both be Yes; Last_IO_Errno and Last_SQL_Errno give the error number when one is No.
How do I fix error 1062 in MySQL replication?
Error 1062 means the row already exists on the replica, so the replica's data differs from the source. Compare the row, fix it on the replica, and restart. Skip the transaction only when the replica's row is known to be right, and make replicas read-only so it does not happen again.
What does error 1236 mean?
The source no longer has the binary log or the GTIDs the replica needs, usually because they were purged while the replica was stopped. The replica must be rebuilt from a copy of the source.
Is it safe to skip a replication error?
It leaves the replica different from the source. Do it only for a transaction whose effect is already on the replica, and check the data afterwards.
Related problems
Sources
- MySQL 8.0 Reference Manual: SHOW REPLICA STATUS, Performance Schema replication tables, Skipping transactions, Cloning remote data, Server error reference