- 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
Verify that MySQL SET FOREIGN KEY CHECKS is set to = 1?
You can verify SET FOREIGN KEY CHECKS is set to = 1 or not with the help of variable
@@foreign_key_checks;
The syntax is as follows −
select @@foreign_key_checks;
You can use SHOW VARIABLES command. The syntax is as follows −
show variables like 'foreign%';
Now you can implement both the syntaxes.
Case 1 − Using variable @@foreign_key_checks.
The query is as follows −
mysql> SELECT @@foreign_key_checks;
Here is the output −
+----------------------+ | @@foreign_key_checks | +----------------------+ | 1 | +----------------------+ 1 row in set (0.00 sec)
Case 2 − Using SHOW command
The query is as follows −
mysql> show variables like 'foreign%';
The following is the output −
+--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | foreign_key_checks | ON | +--------------------+-------+ 1 row in set (0.01 sec)
Advertisements