Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the scope of 'SET foreign_key_checks = 0'? [duplicate]

Tags:

mysql

innodb

Can't really find any details on this, but is the scope of 'SET foreign_key_checks = 0' the current connection, current session or current transaction?

like image 225
sbrattla Avatar asked Jan 22 '13 14:01

sbrattla


1 Answers

It's a session-based statement.

This is to temporarily break the Foreign Key Constraint. It is sometimes necessary to change data in a way that referential integrity needs to be broken during the modification process.

like image 87
John Woo Avatar answered Oct 21 '22 13:10

John Woo