Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

1452 - Cannot add or update a child row ERROR phpmyadmin when importing database
 
ChG00
Jr. Member
 
Total Posts:  30
Joined:  2009-09-11
 

Hi to all,

I am trying to make a copy of my magento store 1.5.1.

I was using the function in the magento backend to export the database.

Then I was creating a new database at all-inkl. and then starting importing the database.sql.gz file with phpmyadmin.

It starting working and stopped maybe two times cause of timed out, but says I could resume and it was working so far.

Then I go this error:

SQL-Befehl:

ALTER TABLE `catalog_eav_attribute` ADD CONSTRAINT `FK_CATALOG_EAV_ATTRIBUTE_ID` FOREIGN KEY ( `attribute_id` ) REFERENCES `eav_attribute` ( `attribute_id` ) ON DELETE CASCADE ON UPDATE CASCADE ;

MySQL meldet: Dokumentation
#1452 - Cannot add or update a child row: a foreign key constraint fails (`d0135016`.<result 2 when explaining filename ‘#sql-910_3e334c’>, CONSTRAINT `FK_CATALOG_EAV_ATTRIBUTE_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CA)

Anybody an idea how this problem can be solved. I found many threads with similar post but not really a solution.

Or shall I use another way to copy the database into a new one?

What is the best way?

I just want to make a backup shop for testing!

Thy a lot in advance for any help.

Christoph

 
Magento Community Magento Community
Magento Community
Magento Community
 
anton78bon
Jr. Member
 
Total Posts:  5
Joined:  2010-10-17
 

Hello.., just create a dump file straight from MySql database, and then restore it in another server.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sousa
Guru
 
Avatar
Total Posts:  348
Joined:  2007-09-02
Porto, Portugal
 

add this to your sql file:

SET FOREIGN_KEY_CHECKS 0;

Or when you export, enable the option Disable foreign key checks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Usman Raja
Jr. Member
 
Total Posts:  2
Joined:  2013-01-31
Birmingham
 

Hi
i am having the same error as you got Christoph

ALTER TABLE `catalog_eav_attributeADD CONSTRAINT `FK_CATALOG_EAV_ATTRIBUTE_IDFOREIGN KEY ( `attribute_id` ) REFERENCES `eav_attribute` ( `attribute_id` ) ON DELETE CASCADE ON UPDATE CASCADE ;

MySQL meldetDokumentation 
#1452 - Cannot add or update a child row: a foreign key constraint fails (`d0135016`.<result 2 when explaining filename â€˜#sql-910_3e334c’>, CONSTRAINT `FK_CATALOG_EAV_ATTRIBUTE_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CA)

now i have changed the
SET FOREIGN_KEY_CHECKS = 0

now i am having this error

- --
-- 
Constraints for table `eav_attribute`
--
SET FOREIGN_KEY_CHECKS =0;


MySQL said

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '---
-- Constraints for table `eav_attribute`
--
SET FOREIGN_KEY_CHECKS 0' at line 1
pls help
Regards
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top