Foreign key constraint error 1452 in MySQL - Magento import

时光毁灭记忆、已成空白 提交于 2019-11-29 00:09:54

You are trying to add a record into catalog_eav_attribute, but you do not have a corresponding record in eav_attribute that matches on attribute_id

If you are also inserting bulk data into eav_attribute, I would recommend doing that first, and then the data would be in the table before the foreign key on catalog_eav_attribute needed to reference it.

This article discusses how you can use:

SET FOREIGN_KEY_CHECKS = 0;
--Do your update here
SET FOREIGN_KEY_CHECKS = 1;

If you cannot change the order that you are inserting data. You just have to make sure your data follows the Foreign Keys once everything has been inserted into the database, before you can re-enable the FOREIGN_KEY_CHECKS

I used a database repair tool, after that did this in SQL:

DROP TABLE catalog_product_flat_1 , catalog_product_flat_2 , catalog_product_flat_3 ;

Now the index is built succesfully.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!