我尝试从另一台服务器上传一个mysql文件。 但是当我上传时,我上传.xml或.zip
时会看到一个白页我需要说它是Magento。
当我上传.sql时,我收到此错误: 错误SQL查询:
--
-- Constraints for table `eav_entity_attribute`
--
ALTER TABLE `eav_entity_attribute` ADD CONSTRAINT `FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE` FOREIGN KEY ( `attribute_id` ) REFERENCES `eav_attribute` ( `attribute_id` ) ON DELETE CASCADE ON UPDATE CASCADE ,
ADD CONSTRAINT `FK_EAV_ENTITY_ATTRIBUTE_GROUP` FOREIGN KEY ( `attribute_group_id` ) REFERENCES `eav_attribute_group` ( `attribute_group_id` ) ON DELETE CASCADE ON UPDATE CASCADE ;
MySQL说:文档
#1452 - 无法添加或更新子行:外键约束失败(
geschenk_test
。#sql-29b_7c74
,CONSTRAINTFK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE
外键(attribute_id
) 参考eav_attribute
(attribute_id
)ON DELETE CASCADE ON 更新CASCADE)
答案 0 :(得分:0)
To restore a .sql file backup without constraint checking, simply add the following statements at the beginning of your .sql file:
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;
At the end of the file, add the statements required to turn on constraint checking again:
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;
SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;
SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;
SET SQL_NOTES=@OLD_SQL_NOTES;
Please refer this http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/restoring_a_backup_of_a_magento_database