We are aware of a potentially service impacting issue. Learn more

Magento - Cannot add or update a child row: a foreign key constraint fails Print

  • 3

Please read the article on the following website; http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/restoring_a_backup_of_a_magento_database

Short explaination: 

The Magento database makes use of foreign key constraints to ensure database integrity. As an example, if a category is deleted, all categories below it in the category tree must be deleted too.
If you make a backup of your Magento database using the built-in backup function (Admin > System > Tools > Backup), Magento inserts special statements in the .sql file to avoid foreign key checks when the tables are restored.
If you backup your Magento database using other tools, like phpMyAdmin or Navicat, these special statements will be missing. When you attempt to run the .sql file, you will get errors like these:

Cannot add or update a child row: a foreign key constraint fails

This error occurs because the data you are importing is provided table by table, row by row, without regard to the logical structure and integrity of the database.

Please follow the instructions at the above url on how to get your phpmyadmin export working correctly. 

Was this answer helpful?

« Back