MySQL Replication – What Happens to Row When Skip-Errors=1062 is Set

MySQLreplication

I found out that I can set skip-errors=1062 in the my.cnf but I need to know what happens to the row when the error happens. Does it get silently dropped? Or is that config option the equivalent to STOP SLAVE;SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;

Best Answer

Yes, it is equivalent, provided the slave error you are skipping is 1062 (Duplicate Key)

It would have to appear in the [mysqld] section of my.cnf like this

[mysqld]
slave-skip-errors=1062

All other error numbers will stop the SQL thread and would require

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;

to have replication conitnue

If you have multiple error numbers to skip, it should be a comma-delimited list of error numbers

[mysqld]
slave-skip-errors=1062,1053

For more information, please read the MySQL Documentation on it.

You asked

Does it get silently dropped?

Yes it does. Just remember that any non-key columns that were supposed to change will not change.