"Duplicate entry 'X' for key 'YYYY.PRIMARY', Error_code: 1062" appears in MySQL or MariaDB logs

Solution Verified - Updated -

Issue

  • Log appears similar to the following:
Duplicate entry ‘XXX’ for key ‘YYYY.PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY
  • Data writing operations are failing.
  • Database replication cannot proceed normally.

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • MySQL
  • MariaDB

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content