proper snapshot of the source, and never modified the data on the replica outside of the replication threads. If the replica stops unexpectedly, it is a bug or you have encountered one of the known replication limitations described in Section 17.5.1, “Replication Features and Issues” . If it is a bug, see Section 17.5.5, “How to Report Replication Bugs or Problems” , for instructions on how to report it. 

•If a statement that succeeded on the source refuses to run on the replica, try the following procedure if it is not feasible to do a full database resynchronization by deleting the replica’s databases and copying a new snapshot from the source: 

1. Determine whether the affected table on the replica is different from the source table. Try to understand how this happened. Then make the replica’s table identical to the source’s and run START REPLICA | SLAVE . 

2. If the preceding step does not work or does not apply, try to understand whether it would be safe to make the update manually (if needed) and then ignore the next statement from the source. 

3. If you decide that the replica can skip the next statement from the source, issue the following statements: 

mysql> SET GLOBAL sql_slave_skip_counter = N ; mysql> START SLAVE; Or from MySQL 8.0.22: mysql> START REPLICA; 

The value of N  should be 1 if the next statement from the source does not use AUTO_INCREMENT or LAST_INSERT_ID() . Otherwise, the value should be 2. The reason for using a value of 2 for statements that use AUTO_INCREMENT  or LAST_INSERT_ID()  is that they take two events in the binary log of the source. 

See also SET GLOBAL sql_slave_skip_counter Statement. 

4. If you are sure that the replica started out perfectly synchronized with the source, and that no one has updated the tables involved outside of the replication threads, then presumably the discrepancy is the result of a bug. If you are running the most recent version of MySQL, please report the problem. If you are running an older version, try upgrading to the latest production release to determine whether the problem persists. 

## 17.5.5 How to Report Replication Bugs or Problems 

When you have determined that there is no user error involved, and replication still either does not work at all or is unstable, it is time to send us a bug report. We need to obtain as much information as possible from you to be able to track down the bug. Please spend some time and effort in preparing a good bug report. 

If you have a repeatable test case that demonstrates the bug, please enter it into our bugs database using the instructions given in Section 1.6, “How to Report Bugs or Problems” . If you have a “phantom”  problem (one that you cannot duplicate at will), use the following procedure: 

1. Verify that no user error is involved. For example, if you update the replica outside of the replication threads, the data goes out of synchrony, and you can have unique key violations on updates. In this case, the replication thread stops and waits for you to clean up the tables manually to bring them into synchrony. This is not a replication problem. It is a problem of outside interference causing replication to fail. 

2. Ensure that the replica is running with binary logging enabled (the log_bin  system variable), and with the --log-slave-updates  option enabled, which causes the replica to log the updates that it receives from the source into its own binary logs. These settings are the defaults. 

