Nic*_*ick 5 mysql phpmyadmin auto-increment
我曾经能够在删除表中的行后将自动增量值设置为低于现有值,但现在我无法这样做(我只能将其设置为高于当前值).我想知道这是因为升级MySQL(5.6.11)/ PHPMyAdmin(3.5.8),还是我仍然能够做到这一点?
小智 10
您可以通过重新启动MySQL服务器来重置隐藏值.InnoDB重新启动后重新计算自动增量值.
更新你的行,然后重启mysql deamon.这可以防止你重建你的桌子什么可以是大桌子的hastle.
从手册:
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.
Run Code Online (Sandbox Code Playgroud)
简而言之,它取决于所使用的存储引擎.