MySQL 设置自动增量“Ad Hoc”
有没有办法以“临时”方式将 mysql 的 auto_increment 设置为某个整数 - 例如,表中已删除 N 个最新行,因此主键/auto_increment 与实际行数相差 N ?有没有办法将 auto_increment 设置为正确的数字,或者手动设置它?
这似乎很常见,所以我相信已经被问过,但我无法找到解决方案,除了这是不可能的或者你不应该这样做。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ALTER TABLE 表名 AUTO_INCRMENT = 100;
ALTER TABLE tablename AUTO_INCREMENT = 100;