当大量数字已存在时重置MySQL auto_increment?

我有一个带有自动递增列的表.我需要将其中一行设置为1000而不再触摸它,但现在我已将其设置为1000,自动增量保持从1001开始并拒绝从1开始.有没有办法解决这个问题?

最佳答案
你不能:

To change the value of the
AUTO_INCREMENT counter to be used for
new rows,do this:

ALTER TABLE t2 AUTO_INCREMENT = value;

You cannot reset the counter to a
value less than or equal to any that
have already been used. For MyISAM,if
the value is less than or equal to the
maximum value currently in the
AUTO_INCREMENT column,the value is
reset to the current maximum plus one.
For InnoDB,if the value is less than
the current maximum value in the
column,no error occurs and the
current sequence value is not changed.

http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

相关文章

优化MySQL数据库发布系统存储的方法有:1.mysql库主从读写分...
使用mysql的方法:在“我的电脑”→右键→“管理”→“服务”...
在mysql中查看root用户权限的方法:1.命令行启动mysql服务;...
MySQL主从复制是用来备份一个与主数据库一样环境的从数据库,...
运行mysql的方法1.启动mysql服务,在“我的电脑”→右键→“...
开启mysql的方法1.可以通过快捷键win+r,输入cmd,打开窗口,...