Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Slave SQL: Error Duplicate entry 'xxxxxxx' for key 'PRIMARY''

Slave SQL: Error Duplicate entry 'xxxxxxx' for key 'PRIMARY''

Slave SQL: Error Duplicate entry 'xxxxxxx' for key 'PRIMARY''

got a weird issue. I have a cron that runs and rapidly inserts multiple records in the db, and also have a web app that may insert at the same time. Neither query specifies the primary key field in the sql; both leaving it up to the auto_increment value. 99% of the time it works fine, but periodically we get the following error on the slave only (never on the primary):


30509 22:21:04 [ERROR] Slave SQL: Error 'Duplicate entry '2024638' for key 'PRIMARY'' on query. Default database: 'DBNAME'. Query: 'INSERT INTO `TABLENAME` (`FirstName`, ... 

Its a standard master/slave setup (i.e. not dual master). I have no clue why the slave would be trying to insert a record with an id already in the table, especially considering the primary key isn't even specified in the query. But then again, I don't fully know how the master/slave sync process works.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close