# Duplicate entry after change auto\_increment\_increment from 2 to1

**URL:** <https://forums.percona.com/t/duplicate-entry-after-change-auto-increment-increment-from-2-to1/6451>\
**Category:** Other MySQL® Questions\
**Created:** [July 9, 2018, 3:26pm UTC](https://forums.percona.com/t/duplicate-entry-after-change-auto-increment-increment-from-2-to1/6451 "2018-07-09T15:26:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baoxiao](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@baoxiao](https://forums.percona.com/u/baoxiao)\
**Post date:** [July 9, 2018, 3:26pm UTC](https://forums.percona.com/t/duplicate-entry-after-change-auto-increment-increment-from-2-to1/6451/1 "2018-07-09T15:26:04Z")

</div>

We have a master-master replication during database migration, now we want to change back to master-slave. After change auto\_increment\_incremen and auto\_increment\_offset to 1 on both database, the application sometimes got below error. Application only connect to the master for write.

Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘72141167’

If we change auto\_increment\_incremen back to 2 then error disappeared.

MySQL version:  
5.7.19-17,Percona Server (GPL), Release 17, Revision e19a6b7b73f

Thanks

---

<div class="post-metadata">

**Author:** ![TarasProsvirov](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@TarasProsvirov](https://forums.percona.com/u/TarasProsvirov)\
**Post date:** [September 24, 2018, 7:16am UTC](https://forums.percona.com/t/duplicate-entry-after-change-auto-increment-increment-from-2-to1/6451/2 "2018-09-24T07:16:58Z")

</div>

Hi baoxiao, I’m having the same issue. Have you found a solution?

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [September 24, 2018, 8:46am UTC](https://forums.percona.com/t/duplicate-entry-after-change-auto-increment-increment-from-2-to1/6451/3 "2018-09-24T08:46:24Z")

</div>

Hello there, first of all sorry we didn’t catch the original question… but here are two possible scenarios for the error. [LIST=1]  
[_]You didn’t stop writes on the slave. In this case you’ll still need to keep auto\_increment\_increment at the higher value.  
[_]You stopped writes on the slave. But the master has values, say: 1–3-5-7 and the slave has: 10-12-14. Occasionally, an app will try to reuse those 10-12-14 values. The workaround in this case is to make sure that maximum numbers in the auto-incremented fields are greater on master than on slave  
[/LIST] Hopefully this will sort out the issue for you.
