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)