Foreign key constraint error 1452 in MySQL - Magento import

后端 未结 2 671
孤街浪徒
孤街浪徒 2020-12-15 12:49

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         


        
相关标签:
2条回答
  • 2020-12-15 13:09

    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.

    0 讨论(0)
  • 2020-12-15 13:22

    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

    0 讨论(0)
提交回复
热议问题