<small id='z8qGf'></small><noframes id='z8qGf'>

    <legend id='z8qGf'><style id='z8qGf'><dir id='z8qGf'><q id='z8qGf'></q></dir></style></legend>

    1. <i id='z8qGf'><tr id='z8qGf'><dt id='z8qGf'><q id='z8qGf'><span id='z8qGf'><b id='z8qGf'><form id='z8qGf'><ins id='z8qGf'></ins><ul id='z8qGf'></ul><sub id='z8qGf'></sub></form><legend id='z8qGf'></legend><bdo id='z8qGf'><pre id='z8qGf'><center id='z8qGf'></center></pre></bdo></b><th id='z8qGf'></th></span></q></dt></tr></i><div id='z8qGf'><tfoot id='z8qGf'></tfoot><dl id='z8qGf'><fieldset id='z8qGf'></fieldset></dl></div>

      <tfoot id='z8qGf'></tfoot>

        • <bdo id='z8qGf'></bdo><ul id='z8qGf'></ul>

        MySQL 中的外键约束错误 1452 - Magento 导入

        时间:2023-10-08
          <tbody id='ksYtP'></tbody>
          <bdo id='ksYtP'></bdo><ul id='ksYtP'></ul>

              1. <legend id='ksYtP'><style id='ksYtP'><dir id='ksYtP'><q id='ksYtP'></q></dir></style></legend>
                  <tfoot id='ksYtP'></tfoot>
                • <i id='ksYtP'><tr id='ksYtP'><dt id='ksYtP'><q id='ksYtP'><span id='ksYtP'><b id='ksYtP'><form id='ksYtP'><ins id='ksYtP'></ins><ul id='ksYtP'></ul><sub id='ksYtP'></sub></form><legend id='ksYtP'></legend><bdo id='ksYtP'><pre id='ksYtP'><center id='ksYtP'></center></pre></bdo></b><th id='ksYtP'></th></span></q></dt></tr></i><div id='ksYtP'><tfoot id='ksYtP'></tfoot><dl id='ksYtP'><fieldset id='ksYtP'></fieldset></dl></div>

                  <small id='ksYtP'></small><noframes id='ksYtP'>

                  本文介绍了MySQL 中的外键约束错误 1452 - Magento 导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试导入 magento 的 sql 转储以及一些产品数据,但出现此外键约束错误:

                  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: Cannot add or update a child row: a foreign key constraint fails:
                  `magento`.`#sql-b33_27`, CONSTRAINT `FK_CATALOG_COMPARE_ITEM_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON )`
                  

                  这是导致错误的sql代码:

                  This is the sql code which is causing the error :

                  --
                  -- Constraints for table `catalog_eav_attribute`
                  --
                  ALTER TABLE `catalog_eav_attribute`
                    ADD CONSTRAINT `FK_CATALOG_EAV_ATTRIBUTE_ATTRIBUTE_ID_EAV_ATTRIBUTE_ATTRIBUTE_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE;
                  

                  我对 sql 查询不是很满意.有人可以解释一下这个查询的作用并指导我解决这个问题吗?谢谢.

                  I am not very comfortable with sql queries. Could some one please explain me what this query does and guide me to resolve this? Thanks.

                  推荐答案

                  您正在尝试将记录添加到 catalog_eav_attribute,但 eav_attribute 中没有相应的记录> 匹配 attribute_id

                  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

                  如果您还要向 eav_attribute 中插入批量数据,我建议先这样做,然后数据会在需要 catalog_eav_attribute 上的外键之前出现在表中参考一下.

                  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;
                  

                  如果您无法更改插入数据的顺序.在将所有内容插入数据库后,您只需确保您的数据遵循外键,然后才能重新启用 FOREIGN_KEY_CHECKS

                  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

                  这篇关于MySQL 中的外键约束错误 1452 - Magento 导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何仅使用 mysql 在 magento 中提取所有产品 id、skus、产品名称、描述? 下一篇:在数据库导入时传递脚本超时

                  相关文章

                  1. <legend id='AEiFE'><style id='AEiFE'><dir id='AEiFE'><q id='AEiFE'></q></dir></style></legend>

                    <i id='AEiFE'><tr id='AEiFE'><dt id='AEiFE'><q id='AEiFE'><span id='AEiFE'><b id='AEiFE'><form id='AEiFE'><ins id='AEiFE'></ins><ul id='AEiFE'></ul><sub id='AEiFE'></sub></form><legend id='AEiFE'></legend><bdo id='AEiFE'><pre id='AEiFE'><center id='AEiFE'></center></pre></bdo></b><th id='AEiFE'></th></span></q></dt></tr></i><div id='AEiFE'><tfoot id='AEiFE'></tfoot><dl id='AEiFE'><fieldset id='AEiFE'></fieldset></dl></div>
                    1. <tfoot id='AEiFE'></tfoot>
                        <bdo id='AEiFE'></bdo><ul id='AEiFE'></ul>

                    2. <small id='AEiFE'></small><noframes id='AEiFE'>