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.
3条答案
按热度按时间1u4esq0p1#
您可以通过重新启动MySQL服务器来重置隐藏值。InnoDB重新计算重启后的自动增量值。
更新你的行,并重新启动mysql守护进程。这可以防止你重建你的表什么可以是一个大表hastle。
jtjikinw2#
来自手册:
因此,简而言之,这取决于所使用的存储引擎。
gmxoilav3#
谢谢你的正确答案,大人物。
InnoDB的解决方法:
只要确保在重新加载之前将表放下;您可能需要通过设置foreign_key_checks = 0来禁用密钥检查;