开发者

can I reset auto_increment field in mySql?

开发者 https://www.devze.com 2022-12-08 09:34 出处:网络
Can I reset the auto-increment index of a MySQL table so that it starts counting from zer开发者_如何学JAVAo again?

Can I reset the auto-increment index of a MySQL table so that it starts counting from zer开发者_如何学JAVAo again?

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


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


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

精彩评论

暂无评论...
验证码 换一张
取 消