0

我尝试从另一台服务器上传 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, CONSTRAINT FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTEFOREIGN KEY ( attribute_id) REFERENCES eav_attribute( attribute_id) ON DELETE CASCADE ON UPDATE CASCADE)

4

1 回答 1

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
于 2013-08-08T09:49:43.110 回答