Search code snippets, questions, articles...

Reset AUTO_INCREMENT Column value MySql

ALTER TABLE tableName AUTO_INCREMENT=1
/*You can replace value 1 to your value 
From where you want to start auto increment */
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

Sometimes it is required to reset a column value that has AUTO_INCREMENT after deleting some rows from a table. You can use this code snippet to reset the index of the auto_increment applied column. Here we are resetting the index to 1 but you can replace it with your value from where you want to start the next index.

Search Index Data (The code snippet can also be found with below search text)

Changing auto increment index after deleting rows MySql
Was this helpful?
0 Comments