i am trying to import a sql dump of magento along with some product data and i get this foreign key constraint error:
`ERROR 1452 (23000) at line 231680: Can
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.
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