can I reset auto_increment field in mySql?

后端 未结 2 1465
一向
一向 2021-01-26 19:29

Can I reset the auto-increment index of a MySQL table so that it starts counting from zero again?

I deleted all the rows in the table--how can I reset that counter as we

相关标签:
2条回答
  • 2021-01-26 19:52

    To delete all rows from a MySQL table AND reset the auto_increment value, use the truncate command.

    http://dev.mysql.com/doc/refman/5.7/en/truncate-table.html

    0 讨论(0)
  • 2021-01-26 20:06

    Or just truncate the table instead of deleting the roles -- that drops and re-adds the table, resetting the autoincrement values in the process

    0 讨论(0)
提交回复
热议问题