Jump to content

Archived

This topic is now archived and is closed to further replies.

freakus_maximus

Reset autoindex

Recommended Posts

Is there a way to reset the autoindex?

Just curious, since with all my testing I go back and just wipe out the data in the tables and start clean but the next autoindex will not start at 1.

I tried removing the autoincrement after deleting the data, then make the id field autoincrement again, but that did not change anything, it still held the old next autoindex value.

Share this post


Link to post
Share on other sites
I use[tt] TRUNCATE table_name [/tt] in MySQL 5+. I think in the older versions it's[tt] DELETE FROM table_name [/tt] as opposed to[tt] DELETE * FROM table_name[/tt].

Share this post


Link to post
Share on other sites
DELETE will remove all records without re-setting the counter... TRUNCATE should work in all versions.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.