How can I export a single trigger from mysql?

export, mysql, triggers

Solution

What you want is a dump of single trigger of your db.

You can take inspiration from this article and from documentation.

For example, this command export only the stored procedures and triggers:

mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt <database> > outputfile.sql

However, I do not think you can dump a single trigger. Since it's only one, maybe it's easier to recreate another dabatase.

Problem

I need to re-create a single trigger in another mysql database - is there an easy way to export a single trigger?

Original source