The SHOW TRIGGERS statement displays triggers defined for tables in a database.
Syntax
SHOW TRIGGERS
[{FROM | IN} database_name]
[LIKE 'pattern' | WHERE expr]
Parameters
| Parameter | Description | |
|---|---|---|
| FROM | IN database_name | Optional. Specifies the name of the database whose triggers you want to view. If you do not specify this option, the triggers of the default database are displayed. |
| LIKE 'pattern' | Optional. Specifies a pattern to match the table name (not the trigger name). You can use the % and _ wildcards. The triggers of the matching table are displayed. |
|
| WHERE expr | Optional. Specifies a condition to select rows using the WHERE clause. |
The SHOW TRIGGERS statement returns only the results of databases and tables with the TRIGGER privilege.
The output of the SHOW TRIGGERS statement contains the following information:
Trigger: the trigger name.Event: the trigger event. This is the type of operation associated with the trigger's activation on the table. The value can beINSERT(a row is inserted),DELETE(a row is deleted), orUPDATE(a row is modified).Table: the table that defines the trigger.Statement: the statement executed when the trigger is activated.Timing: whether the trigger is activated before or after the trigger event. The value can beBEFOREorAFTER.Created: the date and time the trigger was created. The value is of typeTIMESTAMP(2)(with the fractional part in hundredths of a second).sql_mode: the SQL mode in effect when the trigger was created.Definer: the user account that created the trigger, in the format'user_name'@'host_name'.character_set_client: the value of thecharacter_set_clientsystem variable in the current session when the trigger was created.collation_connection: the value of thecollation_connectionsystem variable in the current session when the trigger was created.Database Collation: the collation of the database associated with the trigger.
Trigger information can also be obtained from the INFORMATION_SCHEMA TRIGGERS table. For more information, see INFORMATION_SCHEMA TRIGGERS.
Examples
View the triggers of all tables in the current database.
obclient> SHOW TRIGGERS;
View the triggers of a specified database:
obclient> SHOW TRIGGERS FROM test_db;
View the triggers of tables that match a specific table name pattern:
obclient> SHOW TRIGGERS LIKE 'test%'\G
The query result is as follows:
*************************** 1. row ***************************
Trigger: test_trg
Event: UPDATE
Table: test
Statement: TRIGGER test_trg BEFORE UPDATE ON test FOR EACH ROW
BEGIN
IF NEW.user_num < 1 THEN
SET NEW.user_num = 1;
ELSEIF NEW.user_num > 45 THEN
SET NEW.user_num = 45;
END IF;
END
Timing: BEFORE
Created: 2025-12-23 16:12:32.41
sql_mode: STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER
Definer: root@%
character_set_client: utf8mb4
collation_connection: utf8mb4_general_ci
Database Collation: utf8mb4_general_ci
1 row in set (0.026 sec)
