I have an old and a new magento installation(same version). Both are using the same mysql user and password. I'm trying to copy a few tables from the old one to the new one(trough SSH - using Putty):

INSERT INTO magento_n.eav_entity_store SELECT * FROM magento_o.eav_entity_store;

It worked for a few tables but for this table i get this error:

ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`magento_n`.`eav_entity_store`, CONSTRAINT `FK_EAV_ENTITY_STORE_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCE `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE)

I do not understand this error(i have a table called core_store that has two records one has the id 0 the other one has the id 1). What should/can i do in this case?

Thank you! :D


when dumping data in a database, if the table has a database constraint, it will only accept the record to be inserted into your eav_entity_store table if the referenced table has a record.

--> in practice, eav_entity_store will only accept data if the store id in your dump have been inserted into the store table of your magento database.

you can also ignore the constraints in mysql but at least to get started, I advise not to. Instead, please dump or create the missing store record manually and after only import your eav_entity_store table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.