【问题标题】:How do I resolve 'Unexpected number of row removed!'?如何解决“意外删除的行数!”?
【发布时间】:2015-10-30 05:57:40
【问题描述】:

我正在尝试删除表中的所有数据行并重置自动增量。当我这样做时,我会收到以下消息:

Unexpected number of rows removed!

One row was not removed. Reload the table to be sure that the contents
have not changed in the meantime. Check the Console for possible errors 
inside the primary keys of this table!

更新 当我执行 TRUNCATE TABLE 'users' 时,我会收到此消息

    Cannot truncate a table referenced in a foreign key constraint
 (`marketing`.`designer_application`, CONSTRAINT
 `designer_application_user_id_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES 
`marketing`.`users` (`id`))

【问题讨论】:

  • 截断表名;菜单中还有一个项目
  • 这将帮助您决定访问:dba.stackexchange.com/questions/61240/…>

标签: mysql sequelpro database-management


【解决方案1】:

在您删除它们之前,可能有另一个进程对您选择的相同行进行了操作。如果您使用 UI 删除行,请考虑改用 SQL 查询。使用TRUNCATE 将清除表的内容并将auto increment 重置为0

TRUNCATE TABLE `tablename`;

【讨论】:

    猜你喜欢
    • 2021-12-24
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-02
    • 1970-01-01
    相关资源
    最近更新 更多