During the MySQL to MySQL migration, if the migration log indicates that the migration of events and triggers fails after the migration task is complete, you can manually migrate the events and triggers.
This section describes how to export and import events and triggers in batches.
SELECT TRIGGER_SCHEMA,TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA in ('DB1','DB2','DB3') order by TRIGGER_NAME;
In the preceding statements, DB1, DB2, and DB3 indicate the databases to be migrated to the destination database.
SHOW CREATE TRIGGER TRIGGER_SCHEMA.TRIGGER_NAME \G;
In the preceding statement, replace TRIGGER_SCHEMA and TRIGGER_NAME with the values obtained in 1.a.
SELECT EVENT_SCHEMA,EVENT_NAME FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA in ('DB1','DB2','DB3') order by EVENT_NAME;
In the preceding statements, DB1, DB2, and DB3 indicate the databases to be migrated to the destination database.
SHOW CREATE EVENT EVENT_SCHEMA.EVENT_NAME \G;
In the preceding statement, replace EVENT_SCHEMA and EVENT_NAME with the values obtained in 2.a.
Execute the statements for creating triggers and events exported from the source database in the destination database.