【发布时间】:2012-08-10 03:52:30
【问题描述】:
尝试通过 SSH 转储 magento 数据库时出现以下错误
ERROR 1452 (23000) at line 82966: Cannot add or update a child row: a foreign key constraint fails (`aloodawp/#sql-4136_fcf760`, CONSTRAINT `FK_EAV_ATTRIBUTE_ENTITY_TYPE_ID_EAV_ENTITY_TYPE_ENTITY_TYPE_ID` FOREIGN KEY (`entity_type_id`) REFERENCES `eav_entity_type` (`entity_type_id`) ON DELET)
我不是真正的 shell 或 mysql 专家,知道基础知识,以前从未遇到过这个问题
已解决
Are you getting this error when you dump, or when you are reading the dump back in? SET FOREIGN_KEY_CHECKS=0; and SET FOREIGN_KEY_CHECKS=1; around your dump should solve the problem.
【问题讨论】:
-
转到您正在运行的脚本的第 82966 行,查看您要添加的记录是什么以及给您带来麻烦的外键是什么。然后在为“孩子”运行插入之前手动插入“父亲”记录
-
您是否在转储时收到此错误,或者在重新读取转储时收到此错误?设置 FOREIGN_KEY_CHECKS=0;并设置 FOREIGN_KEY_CHECKS=1;围绕你的转储应该可以解决问题。
-
添加外键检查工作非常感谢
-
@benmarks 这将是一个很好的答案
标签: mysql magento command-line ssh terminal