Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Thursday, 31 December 2009

Reset AutoIncrement Number in MySQL

To reset your autoincrement number, you can simply run the following SQL:

ALTER TABLE 'table_name' AUTO_INCREMENT = X

Where X is the ID number you want to set the increment start point to, so running

ALTER TABLE 'table_name' AUTO_INCREMENT = 0

resets the ID increment process, and

ALTER TABLE 'table_name' AUTO_INCREMENT = 1023

Would set the start seed to 1023 - sometimes useful for making things looked "used", for example with order systems.