Mysql creates a trigger in a database by listening for table changes in another database

sort of:

CREATE TRIGGER
       schema1.triggername
AFTER INSERT ON schema2.table
FOR EACH ROW
BEGIN
       ;
END;

ERROR 1435 (HY000): starting in the wrong circuit

+3
source share
1 answer

The trigger must be in the same schema as the table you are inserting into, but it can access tables in other schemas.

Using your example:

CREATE TRIGGER schema2.triggername
AFTER INSERT ON schema2.the_table
FOR EACH ROW
  INSERT INTO schema1.the_table values (...);
+3
source

Source: https://habr.com/ru/post/1762682/


All Articles