Spot
Spot

Reputation: 8165

Why am I getting duplicate entry errors after MySQL upgrade from 5.7 to 8.0?

So we just upgraded from MySQL 5.7-ubuntu to 8.0. The upgrade seems to have went smoothly, however now we're getting "Duplicate entry" errors every time we try to INSERT.

Investigation has revealed that all the AI (auto increment) values in the DB (on all tables) are set to the last used ID in the table, so it's attempting to INSERT on an existing ID.

I believe that manually bumping the AI value by one on each table should resolve this, but I am curious/concerned about why it happened in the first place. It may be indicative of other issues.

Can someone explain why this happened? (I tried searching this, but enormous amounts of false positives)

Thanks

Upvotes: 2

Views: 695

Answers (1)

Ganesh Chandrasekaran
Ganesh Chandrasekaran

Reputation: 1936

this one explains how its handled in 5.7 and 8

AUTO_INCREMENT Handling in InnoDB

https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling.html

Upvotes: 1

Related Questions