Online Alter Table Shows ERROR 1062 (23000): Duplicate entry 'XXX' for key 'PRIMARY' (Doc ID 1593526.1)

Last updated on JANUARY 05, 2017

Applies to:

MySQL Server - Version 5.6 and later
Information in this document applies to any platform.
Since MySQL 5.1, InnoDB is able to perform table maintenance operations using inplace algorithm (also known as "online alter"), which may be performed much faster and without blocked access.

Symptoms

ALTER TABLE command with "inplace" algorithm shows error message like:

ERROR 1062 (23000): Duplicate entry '2018853841' for key 'PRIMARY'

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms