Today, when I export a database from the server with a SQL file, I find that the import failed, prompting the INSERT statement to execute the error.
When inserting data, the content has a foreign key association and cannot insert data.
You can set the MySQL foreign key constraint by setting the method.
MySQL method for starting and closing foreign KEY constraints (Foreign_key_checks)
To disable a FOREIGN KEY constraint:
SET Foreign_key_checks=0;
To enable foreign KEY constraints:
SET Foreign_key_checks=1;
To view the values of the current FOREIGN KEY constraint:
SELECT @ @FOREIGN_KEY_CHECKS;
When exporting a database with SQLyog, tick "set foreign_key_checks = 0"
You can automatically set the cancel and open foreign key constraints for an exported SQL file
Set off FOREIGN KEY constraints
/**/;
To open a FOREIGN key constraint
/**/;
MySQL Import Database--turn FOREIGN KEY constraints on/off