2

I have two database (connections to two servers), database1 and database2. Is there a way for a trigger function in a table in database1 to access a table in database2? If this is possible, how can I do it? Thanks in advance.

Filburt
  • 17,626
  • 12
  • 64
  • 115
help
  • 809
  • 5
  • 18
  • 35

2 Answers2

3

If you are using Mysql Federated Engine, then the answer is yes.

How to create linked server MySQL

Best regards

Community
  • 1
  • 1
Oscar
  • 13,594
  • 8
  • 47
  • 75
0

I'm not sure about triggers, but in normal queries you can just use the databasename.tablename syntax.

SELECT * 
FROM `DatabaseA`.`Table1` t1
INNER JOIN `DatabaseB`.`Table1` t2 ON (`t1`.`id` = `t2`.`id`)
Cylindric
  • 5,858
  • 5
  • 46
  • 68