Hello Will
I need to reset the auto-increment of a field in MySQL. How do I accomplish this?
Thank you
James from Kentlands
One thought on “How do I go about resetting the AUTO_INCREMENT count in MySQL?”
Hello James
In order to reset the counter you need to run the following script:
ALTER TABLE tablename AUTO_INCREMENT = 1
There are however some conditions:
For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.
Hello James
In order to reset the counter you need to run the following script:
ALTER TABLE tablename AUTO_INCREMENT = 1
There are however some conditions:
For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.