Question
Is it possible to temporarily disable foreign key checks to add the constraint, and then re-enable them?
Asked by: USER2833
104 Viewed
104 Answers
Answer (104)
Yes, you can temporarily disable foreign key checks using `SET foreign_key_checks = 0;`. Add the constraint, then re-enable checks with `SET foreign_key_checks = 1;`. However, this is generally *not recommended* as it bypasses data integrity checks and can lead to inconsistencies. It's better to fix the underlying index issue.