13.7.7.11 SHOW CREATE TRIGGER Statement语句

SHOW CREATE TRIGGER trigger_name

This statement shows the CREATE TRIGGER statement that creates the named trigger. 此语句显示创建命名触发器的CREATE TRIGGER语句。This statement requires the TRIGGER privilege for the table associated with the trigger.此语句要求与触发器关联的表具有TRIGGER权限。

mysql> SHOW CREATE TRIGGER ins_sum\G
*************************** 1. row ***************************
               Trigger: ins_sum
              sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,
                        NO_ZERO_IN_DATE,NO_ZERO_DATE,
                        ERROR_FOR_DIVISION_BY_ZERO,
                        NO_ENGINE_SUBSTITUTION
SQL Original Statement: CREATE DEFINER=`me`@`localhost` TRIGGER `ins_sum`
                        BEFORE INSERT ON `account`
                        FOR EACH ROW SET @sum = @sum + NEW.amount
  character_set_client: utf8mb4
  collation_connection: utf8mb4_0900_ai_ci
    Database Collation: utf8mb4_0900_ai_ci
               Created: 2018-08-08 10:10:12.61

SHOW CREATE TRIGGER output has these columns:输出具有以下列:

Trigger information is also available from the INFORMATION_SCHEMA TRIGGERS table. See Section 26.3.45, “The INFORMATION_SCHEMA TRIGGERS Table”.触发器信息也可从INFORMATION_SCHEMA TRIGGERS表中获得。参见第26.3.45节,“INFORMATION_SCHEMA触发器表”