MySQL设置自动增量"Ad Hoc"; [英] MySQL Set AutoIncrement "Ad Hoc"

查看:48
本文介绍了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.

推荐答案

ALTER TABLE表名AUTO_INCREMENT = 100;

ALTER TABLE tablename AUTO_INCREMENT = 100;

这篇关于MySQL设置自动增量"Ad Hoc";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆