ServerTune

Browse by category

Search    |    Advanced search

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

If you are getting this error message when trying to import your Magento database, there are two possible solutions:

Disable foreign key checks

Then you can import your database into the new site/server.

Using any Linux editor such as vi or pico, edit the database file: YOUR-DATABASE-NAME.sql. Copy and paste the following line at the beginning of the file:

SET foreign_key_checks=0;

Save the file and try importing your database again. It should be working.

 
 
Add comment
 
Views: 1458
 
Votes: 0
 
Comments: 0
 

Other articles in this Category

RSS