Show all triggers in a MySQL database
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Triggers in MySQL are stored procedures that execute automatically when a specific event (INSERT, UPDATE, or DELETE) occurs on a table. They are used for enforcing business rules, maintaining audit logs, and keeping related tables in sync. When managing a database, you need to know which triggers exist, what tables they are attached to, and what they do. This article covers the different ways to list all triggers in a MySQL database, with examples and explanations for each approach.
What Are MySQL Triggers?
A trigger is a named database object that is associated with a table and fires in response to a DML (Data Manipulation Language) event. Each trigger specifies three things: the timing (BEFORE or AFTER), the event (INSERT, UPDATE, or DELETE), and the action (the SQL statements to execute).
Here is a simple trigger that logs every insert into an orders table.
This trigger fires after each row is inserted into orders and records the event in an order_audit table.
Method 1: SHOW TRIGGERS Statement
The simplest way to list triggers is the SHOW TRIGGERS statement.
This returns all triggers in the currently selected database. The result includes columns like Trigger, Event, Table, Statement, Timing, and Created.
To filter triggers for a specific table, use the FROM or IN clause combined with LIKE.
This shows only triggers associated with the orders table.
You can also filter by database.
The output is a table with these key columns.
| Column | Description |
| Trigger | Name of the trigger |
| Event | INSERT, UPDATE, or DELETE |
| Table | The table the trigger is attached to |
| Statement | The SQL body of the trigger |
| Timing | BEFORE or AFTER |
| Created | Timestamp when the trigger was created |
Method 2: Querying INFORMATION_SCHEMA.TRIGGERS
For more control over the output, query the INFORMATION_SCHEMA.TRIGGERS table directly. This approach lets you filter, sort, and select specific columns.
This query returns all triggers in my_database, sorted by table and timing. The INFORMATION_SCHEMA approach is particularly useful in scripts and automation because you can shape the output to match your needs.
Useful Columns in INFORMATION_SCHEMA.TRIGGERS
- TRIGGER_NAME: The name of the trigger.
- EVENT_MANIPULATION: The DML event that fires the trigger (INSERT, UPDATE, DELETE).
- EVENT_OBJECT_TABLE: The table the trigger is attached to.
- ACTION_STATEMENT: The SQL code that executes when the trigger fires.
- ACTION_TIMING: Whether the trigger fires BEFORE or AFTER the event.
- TRIGGER_SCHEMA: The database the trigger belongs to.
Method 3: Using mysqldump
If you need to export trigger definitions along with your schema, mysqldump includes triggers by default.
This outputs the CREATE TRIGGER statements for all triggers in the database, which is useful for version control and migration scripts.
To exclude triggers from a dump, use --skip-triggers.
Listing Triggers for a Specific Table
When you need to inspect triggers on a single table, combine INFORMATION_SCHEMA with a WHERE clause.
This is more precise than SHOW TRIGGERS LIKE 'orders' because the LIKE clause in SHOW TRIGGERS matches against the table name pattern, which can return unexpected results if table names share prefixes.
Practical Example: Auditing All Triggers
Here is a query that produces a clean summary of every trigger in a database, showing the trigger name, when it fires, and what it does.
The DATABASE() function returns the currently selected database, so you do not need to hardcode the name. The LEFT() function truncates long trigger bodies for readability.
Common Pitfalls
- Not selecting the right database.
SHOW TRIGGERSonly shows triggers in the current database. If you see an empty result, make sure you ranUSE my_databasefirst, or specify the database explicitly withFROM. - Insufficient privileges. You need the
TRIGGERprivilege on the table or theSUPERprivilege to view trigger definitions. If theACTION_STATEMENTcolumn returns empty, check your user permissions. - Hidden trigger interactions. Multiple triggers on the same table can interact in unexpected ways. If you have both a BEFORE INSERT and AFTER INSERT trigger, they execute in that order for every row. List all triggers on a table before adding new ones to avoid conflicts.
- Trigger-based performance issues. Triggers add overhead to every DML operation on their table. If a table has many triggers and handles high write volume, the cumulative cost can be significant. Use the queries above to audit which triggers exist and whether they are all still necessary.
- Forgetting about trigger ordering. Starting with MySQL 5.7.2, you can have multiple triggers with the same timing and event on the same table, ordered with
FOLLOWSandPRECEDES. TheINFORMATION_SCHEMAquery does not show this ordering by default. CheckACTION_ORDERif trigger execution order matters.
Summary
MySQL provides three main ways to list triggers: SHOW TRIGGERS for quick interactive checks, INFORMATION_SCHEMA.TRIGGERS for scriptable and filterable queries, and mysqldump --triggers for exporting definitions. Use the INFORMATION_SCHEMA approach when you need to filter by table, sort results, or integrate trigger inspection into automated tooling. Always verify your database context and user privileges when trigger queries return empty results.
Related reading
- Show constraints on tables command
- Show Procedures/Functions MySQL Command Line
- Show tables, describe tables equivalent in redshift
- Simple DynamoDB request failing with ResourceNotFoundException
- Simple Random Samples from a MySQL Sql database
- Simple way to calculate median with MySQL
- skip and limit in aggregation framework
- Sleep Command in T-SQL?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.