Export and import data from PHPMYADMIN

12,016

The problem is pma doesnt care about the order for the insert rows. so it happens a table-row is inserted with an FK where the FK row is not yet imported.

To solve this use the checkbox Disable Foreign Key Checks when exporting from PhpMyadmin. Or set it yourself:

SET FOREIGN_KEY_CHECKS=0;

and at the end:

SET FOREIGN_KEY_CHECKS=1;
Share:
12,016
Admin
Author by

Admin

Updated on July 28, 2022

Comments

  • Admin
    Admin almost 2 years

    I exported data with phpMyAdmin, but when I import the data I get this error:

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

    I can set the data accordingly and then I don't get the error. But is there a better way to do this? Something like disabling some options in phpMyAdmin or adding some query to SQL?