Home > database >  Could you tell me why cancel the foreign key constraints (set foreign_key_checks=0) , or delete data
Could you tell me why cancel the foreign key constraints (set foreign_key_checks=0) , or delete data

Time:10-23

Delete the first two records complains (mysql error 1451) :

But it can be deleted successfully other data, such as article 3 has been deleted successfully:

CodePudding user response:

The set foreign_key_checks=0; If only for the current connection effectively, not global
So delete operation to the connection in the execution of this command

CodePudding user response:

Don't quite understand, specific how should do

CodePudding user response:

reference 1st floor csdn_castiel response:
set foreign_key_checks=0; If only for the current connection effectively, not global
So delete the connection that will be in the execution of this command

Well instruction meaning should be "temporarily shut down foreign key inspection", is for the convenience of "quick delete data", but in front of the "restore foreign key check" referential integrity, to ensure that the data is for reference,
  • Related