MySQL 删除后不断添加 2 行!
我的 MySQL 表有一个非常奇怪的问题。一段时间后,我意识到表末尾有 2 行额外的行。删除 phpmyadmin 中的条目只会创建另外 2 个不需要的行,并且 id
会自动递增。我尝试使用 phpmyadmin 和 Navicat 进行删除,两者仍然会导致在刷新时创建 2 个额外的行。有什么想法吗?
编辑:我确实注意到了一些奇怪的事情,最后一个自动递增主键的 id 是 2682,但是选项选项卡中的 AUTO_INCRMENT 值是 7567,有什么问题吗?对于没有此问题的其他表,这 2 个值是相同的...
更新:我将表导出到 .txt 文件中,并注意到有带有 NULL 和默认值的空条目以及空条目值从 id=2683 到 id=7567!
I have this really weird problem with my MySQL table. After some time a realise that there are 2 extra rows at the end of the table. Deleting the entries in phpmyadmin just creates another 2 more of these unwanted rows with increasing id
that is on auto-increment
. I tried deleting with phpmyadmin and Navicat, both still causes the 2 extra rows to be created on refresh. Any ideas?
EDIT: I did notice something weird, the last id which is a auto-incrementing primary key is 2682, but the AUTO_INCREMENT value in the options tab is 7567, is something amiss? These 2 values are the same for other tables which did not have this problem...
UPDATE: I exported the table into a .txt file, and notice there are empty entries with NULLS and default values and empty values from id=2683 to id=7567!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此之前,我正在使用 Codeigniter 框架运行一些错误的 Active Records 代码。因此,问题实际上是由于
AUTO_INCRMENT
数字与表中最后一个id
不同,并且不知何故有来自id=2683
的空行至id=7567
。解决方案是将表导出到 Excel,从数据库中删除旧表,删除 Excel 中
id=2682
之后的所有行,然后将 Excel 导入回表中以重新创建原始表。谢谢你们的建议! :)
I was running some erroneous Active Records code using Codeigniter framework before this happened. So the problem is really due to the
AUTO_INCREMENT
number being different from the lastid
in the table, and somehow having empty rows fromid=2683
toid=7567
.Solution was to export table to excel, delete the old table from db, remove all rows after
id=2682
in excel and import the excel back into the table to recreate the original table.Thanks for the suggestions guys! :)