I've been deleting ID's and test records from my tables, I was just wondering how to get it to restart at 0. Cause now with an empty table my first record is starting at like 13, and so on.
any help?
resetting ID incremental field with phpMyAdmin
Moderator: General Moderators
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If you're deleting all the information from a table, instead of doing it row by row just empty the data instead.
Then the auto-increment field is automatically reset.
Mac
Code: Select all
DELETE FROM tableMac
Auto_Increment rules
Prior to MySQL 3.23
Auto_Increment would always increment from the highest value found in the table. So deleting all the rows one-by-one or all at once would reset the counter.
As of MySQL 3.23
Auto_Increment in only forward sequential and will not reuse previous values even when they are erased. You must do a DELETE FROM tbl_name. This is because this command not only erases the rows but RESETS the table as well, which resets the counter.
FFR
Auto_Increment would always increment from the highest value found in the table. So deleting all the rows one-by-one or all at once would reset the counter.
As of MySQL 3.23
Auto_Increment in only forward sequential and will not reuse previous values even when they are erased. You must do a DELETE FROM tbl_name. This is because this command not only erases the rows but RESETS the table as well, which resets the counter.
FFR