You are viewing an old revision of this post, from July 8, 2020 @ 15:40:55. See below for differences between this version and the current revision.

MySQL – Remove all triggers by using the SQL queries

Sometimes you want to remove all existing triggers in your database so that you can create the new one.

You can execute the following SQL query to generate all necessary SQL queries to remove the triggers in your database.

SELECT Concat('DROP TRIGGER ', Trigger_Name, ';') FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = 'your_database_name';

After that, you can export the result into the SQL file to execute those queries.

Hope it is useful for you 🙂

Revisions

  • July 8, 2020 @ 15:42:06 [Current Revision] by Sharing Solution
  • July 8, 2020 @ 15:41:27 by Sharing Solution
  • July 8, 2020 @ 15:40:55 by Sharing Solution

Revision Differences

July 8, 2020 @ 15:40:55Current Revision
Content
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>Sometimes you want to remove all existing triggers in your database so that you can create the new one.</p>Unchanged: <p>Sometimes you want to remove all existing triggers in your database so that you can create the new one.</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>You can execute the following SQL query to generate all necessary SQL queries to remove the triggers in your database.</p>Unchanged: <p>You can execute the following SQL query to generate all necessary SQL queries to remove the triggers in your database.</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Deleted: <p>SELECT Concat('DROP TRIGGER ', Trigger_Name, ';') FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = 'your_database_name';</p> Added: <p><strong>SELECT Concat('DROP TRIGGER ', Trigger_Name, ';') FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = 'your_database_ name';</strong></p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>After that, you can export the result into the SQL file to execute those queries.</p>Unchanged: <p>After that, you can export the result into the SQL file to execute those queries.</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>Hope it is useful for you :)</p>Unchanged: <p>Hope it is useful for you :)</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply