mysql set foreign key constraint SET FOREIGN_KEY_CHECKS=1

Problem description: If a foreign key constraint is established between a table and a table in Mysql, the table cannot be deleted and the table structure can not be modified

Solution:

Cancel the foreign key constraint in Mysql: SET FOREIGN_KEY_CHECKS=0;

Then export the data of the original table to sql statement, re-create this table, and then import the data using sql,

Then set the foreign key constraints: SET FOREIGN_KEY_CHECKS=1;

Guess you like

Origin blog.csdn.net/y_bccl27/article/details/109263354