Sample Header Ad - 728x90

MySQL InnoDB Reset Existing Auto-Increment Records

3 votes
2 answers
2177 views
Using MySQL Workbench, I have a MySQL InnoDB with a few hundred records. The records table has the following format (id is auto_increment and unique); +------+-------+ | id | name | +------+-------+ | 2500 | jo | +------+-------+ | 2511 | jim | +------+-------+ | 2512 | sarah | +------+-------+ | 2513 | jane | +------+-------+ Notice my first record begins at 2500. Presumably this is because I have dropped and re-imported the table data numerous times. Is there any way I can 'reset' the id field so that the records begin at 1 and not 2500? I want the table to look like this: +----+-------+ | id | name | +----+-------+ | 1 | jo | +----+-------+ | 2 | jim | +----+-------+ | 3 | sarah | +----+-------+ | 4 | jane | +----+-------+ Any advice is appreciated.
Asked by TheOrdinaryGeek (177 rep)
Jun 21, 2018, 09:27 AM
Last activity: Jul 28, 2025, 03:36 PM