MySQL Set AutoIncrement “Ad Hoc”

三世轮回 提交于 2020-01-30 10:41:10

问题


Is there a way to set mysql's auto_increment to a certain integer in an "ad hoc" way - for example, N of the latest rows have been deleted in a table, so the primary key/auto_increment is N off from the actual # of rows? Is there a way to set the auto_increment to the right number, or to manually set it?

This seems common, so I believe it has been asked already, but I've not been able to find a solution, other than that this isn't possible or you shouldn't do it.


回答1:


ALTER TABLE tablename AUTO_INCREMENT = 100;



来源:https://stackoverflow.com/questions/3091838/mysql-set-autoincrement-ad-hoc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!