Connect to another host from inside mysql stored procedure

Posted on

Question :

I have two virtual servers on one physical machine.

There are MySQL users and passwords the same for both of them.

I want to write something like this:

SELECT * FROM [host_name].[db_name].[table_name]

Federated / FederatedX is not a solution for me. At least I want to avoid using it if it is possible.

If what I want is not possible I need some solution to do the following:

I have two MySQL servers: server1 and server2.

I want to set a trigger on a few tables in server1 so i.e. when new row appears there a part of that row should go to server2.

I don’t want an entire row to be replicated. There might be some values on which I will want to remove some rows form server2 and e.t.c.

I was thinking I should call some procedure on the trigger if it is possible.

Answer :

No. One connection can talk to only one MySQL server.
Any Stored Routine lives in a single MySQL server, so another connection is not allowed for.

Leave a Reply

Your email address will not be published. Required fields are marked *