为了测试查询的正确性,我需要在数据库中禁用所有触发器。 我看到information_schema中存在TRIGGERS表。 是否可以使用此表暂时禁用所有触发器? 例如:
update TRIGGERS set TRIGGERS_SCHEMA='myschema_new'
where TRIGGERS_SCHEMA='myschema'
完成所有测试后,返回所有触发器,如下所示:
update TRIGGERS set TRIGGERS_SCHEMA='myschema'
where TRIGGERS_SCHEMA='myschema_new'
也许这会损坏数据库或触发器将无法起作用?我在文档中没有找到相关内容。
information_schema
表无法被修改,因为它们实际上是视图。参考链接:http://dev.mysql.com/doc/refman/5.1/en/information-schema.html。 - Joel B Fant