- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to disable MySQL foreign key checks and what are the benefits of
disabling it?
We can disable foreign key checks with the help of the following statement −
mysql> Set foreign_key_checks = 0; Query OK, 0 rows affected (0.00 sec)
And we can enable it with the help of the following statement −
mysql> Set foreign_key_checks = 1; Query OK, 0 rows affected (0.00 sec)
Some benefits of disabling foreign key checks are as follows −
- After disabling foreign key checks we can load data into parent and child table in any order. Otherwise, we must have to load the data first in the parent table and then in the child table.
- Without disabling foreign key checks we cannot drop a table that is referenced by a foreign key constraint.
Advertisements