How to reset the autoincrement field in Mysql data base?
Asked
Active
Viewed 973 times
0
-
If you want more answer, specify why you want to reset it. – Rick James Aug 02 '16 at 19:35
1 Answers
0
You can reset the auto-increment column by using the following command:
ALTER TABLE table_name AUTO_INCREMENT = 10;
You can retrieve the most recent automatically generated AUTO_INCREMENT value with the LAST_INSERT_ID() SQL function.
If you wish to set auto-increment value to be 1, you can also truncate the table data.
TRUNCATE TABLE table_name;
I hope this answer will help you. Thanks.
Rathish Kumar B
- 2,304
- 5
- 24
- 36