Permalink: http://bit.ly/1kBCcQu
One of the sorely wanted features missing in MySQL is the ability
to disable/enable triggers on the fly. By comparison,
disabling/enabling Foreign Key constraints can be simply done by
setting a server system variable:
SET FOREIGN_KEY_CHECKS = [TRUE|FALSE];
Now as of version 5.6, there is no built-in server system
variable TRIGGER_CHECKS in MySQL. A simple workaround is to
instead use a user-defined session variable. The setting for
trigger checks stored into the session variable allows the
setting to be seen by all statements, including all stored
procedures and functions, as long as the user is connected, which
for this workaround is in effect similar to using a server system
variable.
Besides a session variable that switches the checks for all
triggers, to …