Error
Error Code:
1360
MariaDB Error 1360: Trigger Does Not Exist
Description
Error 1360 in MariaDB indicates that an operation attempted to reference or modify a database trigger that does not exist. This typically occurs when trying to drop, alter, or execute a statement that implicitly relies on a trigger that has either not been created or was previously removed.
Error Message
Trigger does not exist
Known Causes
4 known causesTypo in Trigger Name
The specified trigger name in the SQL statement does not match the actual name of any existing trigger in the database.
Trigger Not Yet Defined
The database trigger has not been created in the current schema, or the creation script failed to execute successfully.
Trigger Was Dropped
The trigger existed previously but has since been explicitly removed from the database by another user or an earlier script.
Incorrect Database Selected
The operation is being attempted in the wrong database schema where the intended trigger does not exist.
Solutions
3 solutions available1. Verify Trigger Name and Existence easy
Double-check the trigger name for typos and confirm its existence in the database.
1
Connect to your MariaDB server.
mysql -u your_user -p
2
Select the database where the trigger is expected to exist.
USE your_database_name;
3
List all triggers in the current database and look for the trigger you are trying to use. Pay close attention to spelling and case sensitivity.
SHOW TRIGGERS;
4
If the trigger is not listed, it either doesn't exist, was dropped, or is in a different database. If it exists but with a slightly different name, correct your query to use the exact name.
2. Recreate the Trigger medium
If the trigger is missing or corrupted, recreate it using its original definition.
1
Obtain the `CREATE TRIGGER` statement for the missing trigger. This might be from your application's deployment scripts, version control, or by retrieving it from another environment where it exists.
SHOW CREATE TRIGGER trigger_name;
2
Connect to your MariaDB server and select the correct database.
mysql -u your_user -p
USE your_database_name;
3
Execute the `CREATE TRIGGER` statement to recreate the trigger.
-- Example: CREATE TRIGGER trigger_name BEFORE INSERT ON your_table FOR EACH ROW BEGIN ... END;
4
Verify that the trigger now exists by running `SHOW TRIGGERS;`.
3. Check Trigger Visibility and Scope medium
Ensure the trigger is defined in the correct database and is accessible from where you are trying to invoke it.
1
Connect to your MariaDB server.
mysql -u your_user -p
2
If you are executing a statement that should fire a trigger, ensure you are `USE`ing the correct database where that trigger is defined.
USE your_database_name;
3
If you are trying to manage triggers from a different database context, you might need to qualify the trigger name or explicitly select the database.
SELECT * FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = 'your_database_name' AND TRIGGER_NAME = 'trigger_name';
4
Triggers are database-specific. If you created the trigger in `database_A` but are performing operations on `database_B`, the trigger won't fire unless it's also defined in `database_B`.