MySQL Replication Duplicate Entry for Primary Key
What the number 914166 indicates?

The number indicates the row of the table where you are trying to insert data. For example, you are trying to insert some values to 914166th row.

Why this error occurs?

This error occurs because of duplicate value. You are trying to insert/update 914166 to a table activity as a primary key, but the value 914166 already exists in that table activity.

How do you actually continue with the query that poses the error?

You cannot continue with that query, since primary key column is a unique column, it does not accept duplicate values. You can skip this query and continue with the next query by using the following statements:

stop slave;

set global sql_slave_skip_counter = 1;

start slave;


Please note that, skipping errors is not a good option, you should try to fix the issues and start slave as suggested by MySQL.

Work around:

Is that mentioned query is complete statement?

It seems the given query is not a insert query but it is a update statement and it is not updating primary key of the activity table.

Check in master server, whether the mentioned primary key (id) column belongs to activity table or not and check the value (id=914166) exists in that column.

select * from zo_dev_20121216.activity where id = 914166;


If the value exist in that activity table, check in slave server, whether the particular value (id=914166) is exist or not, if it exist in slave server, you can simply skip the query.

select * from zo_dev_20121216.activity where id = 914166;


If you are getting empty result set for the above 2 queries, you can be sure that, the query is incomplete, or you are debugging wrong query.

The point is that, the query is trying to insert/update a value into a activity table which is already exists in that table.

I hope it will help you as a starting point for debugging the error.