Replication Errors
suggest changeWhen an event fails on the replica, MySQL stops replication so you can fix it. Common causes are a duplicate key, or a row to update or delete that is not there. You can skip events. That is usually the wrong fix, because the replica then drifts from the source.
To skip just one query that is hanging the slave, use the following syntax
SET GLOBAL sql_slave_skip_counter = N;
This skips the next N events from the source. It is valid only while the replica threads are stopped. It does not work when GTID_MODE=ON. In MySQL 8.0.22 and later the threads are stopped with STOP REPLICA.
STOP SLAVE;
SET GLOBAL sql_slave_skip_counter=1;
START SLAVE;
In some cases this is fine. But if the statement is part of a multi-statement transaction, it becomes more complex, because skipping the error producing statement will cause the whole transaction to be skipped.
If you want to skip more queries which producing same error code and if you are sure that skipping those errors will not bring your slave inconsistent and you want to skip them all, you would add a line to skip that error code in your my.cnf.
For example you might want to skip all duplicate errors you might be getting
1062 | Error 'Duplicate entry 'xyz' for key 1' on query
Then add the following to your my.cnf
slave-skip-errors = 1062
You can skip also other type of errors or all error codes, but make sure that skipping those errors will not bring your slave inconsistent. The following are the syntax and examples
slave-skip-errors=[err_code1,err_code2,...|all]
slave-skip-errors=1062,1053
slave-skip-errors=all
slave-skip-errors=ddl_exist_errors