What is the point of installing @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 and FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS in the following script?

 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; USE `events`; /* Alter table in target */ ALTER TABLE `eventlog` ENGINE=InnoDB; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 

As I understand it, the FOREIGN_KEY_CHECKS=0 expression disables the validation of foreign keys. And what is OLD_FOREIGN_KEY_CHECKS necessary OLD_FOREIGN_KEY_CHECKS ? Is it just a variable that temporarily stores the value of the global @@FOREIGN_KEY_CHECKS ?

    1 answer 1

    Source: http://dev.mysql.com/doc/workbench/en/workbench-faq.html

    Determines whether to check it out. If you want to see foreign keys

    The setting indicates whether the server should verify the existence of the target table when creating the key.