Mike The Elf
Mike The Elf

Reputation: 88

Reset auto increments with data still in table MYSQL

Most posts I have seen have been about resetting the auto-increments on empty tables. I have got a table with data in it that has had old record deleted from it. In the past my search has come up with answers like "leave it it doesnt matter" I want to be a neat freak and clean up my tables. What is the best way to do this? should i move everything to a new table and truncate the old one then move it all back? would the auto-increment values move with it or would they start from 1 when i move the data around?

Upvotes: 0

Views: 160

Answers (1)

Hans
Hans

Reputation: 447

Just set the auto increment value like this:

ALTER TABLE users AUTO_INCREMENT=1001;

Upvotes: 1

Related Questions