MySQL: Replica & auto-increment

I setup a replica between two big MySQL server for a customer.

Sometimes, when the replica was broken, I had lot of issues with columns defined as “auto-increment”. It’s not always possible to stop updates on the master, dump the data and restore them on the replica (DB’s are used on a 24×7 basis).

To avoid this issue, you can “reset” the auto-increment counter via the following command:

truncate table TABLENAME

More info about this command is available here.

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.