Parker Smith Software

 

resetting the auto_increment counter in MySQL

By Brian Webb

28 May 2008

Have you ever had a table where you wanted to drop all the information and reset the id field? Say you have the auto_increment value at 1024 and you want to drop all the data and make all new rows start from 1. Or maybe you have the auto_increment value at 1024 and you want to jump it to have all new rows start from 10024. Here is how:

1
2

ALTER TABLE {table_name} AUTO_INCREMENT = {new_value};
 
 
 
No Spam: 8 + 5 =
 
May 28, 2008 - Brian Webb
0
 
May 15, 2008 - Brian Webb
0