【问题标题】:Can triggers on the tables in schema INFORMATION_SCHEMA be created in mysql (5.5) ?可以在 mysql (5.5) 中创建模式 INFORMATION_SCHEMA 中的表的触发器吗?
【发布时间】:2014-03-29 18:07:38
【问题描述】:
我希望能够在创建表之前暂停一下(几秒钟左右),以便我可以在我的控制台中发现安装过程中的哪个步骤正在运行“CREATE TABLE”语句。
如果我能够在“INFORMATION_SCHEMA”中的表上创建触发器,我假设我能够捕获尝试创建表的确切时刻,并且我可以看到执行的步骤我正在运行的脚本开始创建文件。
目前
当我引用INFORMATION_SCHEMA 中的表时,CREATE TRIGGER ... 语句不执行任何操作。
有没有办法绕过这个?
【问题讨论】:
标签:
mysql
information-schema
【解决方案1】:
您不能在 information_schema 数据库中的表上设置触发器。
参见手册。
MySQL 5.1 Reference Manual
Chapter 20. INFORMATION_SCHEMA Tables
Usage Notes for the INFORMATION_SCHEMA Database
INFORMATION_SCHEMA is a database within each MySQL instance, the place that stores
information about all the other databases that the MySQL server maintains. The
INFORMATION_SCHEMA database contains several read-only tables. They are actually views, not
base tables, so there are no files associated with them, and you cannot set triggers on them.