Home > Database > Mysql Tutorial > body text

MySQL foreign key constraints disabling and enabling command sharing

黄舟
Release: 2017-03-18 14:03:30
Original
2086 people have browsed it

The following editor will bring you an articleMySQLdisabling and enabling commands for foreign key constraints. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look

Disabling and enabling MySQL foreign key constraints:

MySQL foreign key Whether the constraint is enabled is indicated by a global variable :

FOREIGN_KEY_CHECKS=0; 禁用状态
FOREIGN_KEY_CHECKS=1; 启用状态
Copy after login

To view the current value of FOREIGN_KEY_CHECKS, you can use the following command:

SELECT @@FOREIGN_KEY_CHECKS;
Copy after login

Disable foreign key constraints:

SET FOREIGN_KEY_CHECKS=0;
Copy after login

Enable foreign key constraints:

SET FOREIGN_KEY_CHECKS=1;
Copy after login

The above is the detailed content of MySQL foreign key constraints disabling and enabling command sharing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!