- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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)
- Related Articles
- How to disable MySQL foreign key checks and what are the benefits of disabling it?
- MySQL Syntax to create Foreign Key?
- How to identify foreign key in MySQL DB?
- Set existing column as Primary Key in MySQL?
- Get a list of Foreign Key constraints in MySQL
- sp_help for MySQL to display field types and foreign key constraints?
- How to refer primary key as Foreign to various table in MySQL?
- Foreign Key in RDBMS
- Is it compulsory to set PRIMARY KEY for AUTO_INCREMENT value?
- Set 1 for NOT NULL value in MySQL
- Difference between Primary key and Foreign key in Database
- Difference Between Primary key and Foreign key in DBMS
- JavaScript - Set object key by variable
- Difference between Primary key and Foreign key in SQL Database
- How can we set PRIMARY KEY on multiple columns of a MySQL table?

Advertisements