如何成功导出Magento 1.9数据库(MySQL 5.6)并将其导入MySQL 5.5

时间:2018-09-26 17:54:19

标签: mysql import foreign-keys export magento-1.9

我已转储MySQL(5.6.40-MySQL Community Server(GPL))数据库(Magento 1.9),并尝试将其导入MySQL(5.5.55-38.8-log-Percona Server(GPL),版本38.8 ,修订版11f5bbd),在导入期间,大多数脚本会正常执行,但其中一些脚本会失败,如下所示:

10:48:04    
ALTER TABLE `affiliateplusprogram_category`   
ADD CONSTRAINT `affiliateplusprogram_category_ibfk_1` FOREIGN KEY 
(`program_id`) REFERENCES `affiliateplusprogram` (`program_id`) ON DELETE 
CASCADE ON UPDATE CASCADE,   ADD CONSTRAINT 
`affiliateplusprogram_category_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES 
`catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,   
ADD CONSTRAINT `affiliateplusprogram_category_ibfk_3` FOREIGN KEY (`store_id`) 
REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
  

错误代码:1452。无法添加或更新子行:外键约束      失败(dailynuc_dailynu#sql-1466_121c50b,约束      affiliateplusprogram_category_ibfk_2外键(category_id)参考      catalog_category_entityentity_id)上删除串联      0.015秒

请指导我如何正确执行此操作,非常感谢您提供任何帮助!

1 个答案:

答案 0 :(得分:0)

仅通过

禁用按键检查
SET FOREIGN_KEY_CHECKS=0;

在sql dump的顶部。

在迁移完成后也将它们重新打开

SET FOREIGN_KEY_CHECKS=1;