0

How to reset the autoincrement field in Mysql data base?

ypercubeᵀᴹ
  • 99,450
  • 13
  • 217
  • 306

1 Answers1

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,320
  • 5
  • 24
  • 36