All pages
Powered by GitBook
1 of 1

Loading...

SHOW TRIGGERS

List triggers defined on tables. View metadata such as the trigger event, timing, and the table it is associated with.

Syntax

Description

SHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause is given). This statement requires the privilege.

SHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause is given). This statement requires the SUPER privilege.

The LIKE clause, if present on its own, indicates which table names to match and causes the statement to display triggers for those tables. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .

Similar information is stored in the table.

If there are multiple triggers for the same action, then the triggers are shown in action order.

Examples

For the trigger defined at :

Listing all triggers associated with a certain table:

character_set_client is the session value of the system variable when the trigger was created.

collation_connection is the session value of the system variable when the trigger was created.

Database Collation is the collation of the database with which the trigger is associated.

character_set_client, collation_connection, andDatabase Collation are not available.

Old triggers created before MySQL 5.7 and MariaDB 10.2.3 have NULL in the Created column.

See also

  • table

This page is licensed: GPLv2, originally from

SHOW TRIGGERS [FROM db_name]
    [LIKE 'pattern' | WHERE expr]
SHOW CREATE TRIGGER
  • Trigger Limitations

  • TRIGGER
    Extended SHOW
    information_schema.TRIGGERS
    Trigger Overview
    character_set_client
    collation_connection
    Trigger Overview
    CREATE TRIGGER
    DROP TRIGGER
    information_schema.TRIGGERS
    fill_help_tables.sql
    SHOW triggers Like 'animals' \G
    *************************** 1. row ***************************
                 Trigger: the_mooses_are_loose
                   Event: INSERT
                   Table: animals
               Statement: BEGIN
     IF NEW.name = 'Moose' THEN
      UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
     ELSE 
      UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
     END IF;
    END
                  Timing: AFTER
                 Created: 2016-09-29 13:53:34.35
                sql_mode: 
                 Definer: root@localhost
    character_set_client: utf8
    collation_connection: utf8_general_ci
      Database Collation: latin1_swedish_ci
    SHOW TRIGGERS FROM test WHERE `Table` = 'user' \G
    *************************** 1. row ***************************
                 Trigger: user_ai
                   Event: INSERT
                   Table: user
               Statement: BEGIN END
                  Timing: AFTER
                 Created:  2016-09-29 13:53:34.35
                sql_mode: 
                 Definer: root@%
    character_set_client: utf8
    collation_connection: utf8_general_ci
      Database Collation: latin1_swedish_ci
    SHOW triggers WHERE Event Like 'Insert' \G
    *************************** 1. row ***************************
                 Trigger: the_mooses_are_loose
                   Event: INSERT
                   Table: animals
               Statement: BEGIN
     IF NEW.name = 'Moose' THEN
      UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
     ELSE 
      UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
     END IF;
    END
                  Timing: AFTER
                 Created: 2016-09-29 13:53:34.35
                sql_mode: 
                 Definer: root@localhost
    character_set_client: utf8
    collation_connection: utf8_general_ci
      Database Collation: latin1_swedish_ci