views:

1443

answers:

3

I'm afraid that I already know the answer to my question, but I'll ask it anyway:

When there are two MySQL DB servers, can I access data that is stored on the other server?

In other words: Can I somehow do this:

INSERT INTO table (x, y, z)
   SELECT x, y, x+y
      FROM [otherserver].[database].[table]

Is the answer really as short as "No"?

+2  A: 

You may want to check out this article. It sounds like it explains how to do what you want to do.

Paolo Bergantino
Thought about something like that for a moment, but I can't do it that way, because we use replication for... well... replication - between other servers. :)
BlaM
+1  A: 

The answer is a definite "No", I'm afraid. If you think about it, you're asking the server on which you're executing the query to connect to [otherserver]. It has no way of knowing how to do so.

David Grant
Which is not so obvious, because there *could* be a secret command that I don't know that tells server A how to connect to server B ;)
BlaM
+2  A: 

You can set up federated tables in MySQL to accomplish what you're trying to do. There are some limitations.

http://dev.mysql.com/doc/refman/5.0/en/federated-use.html http://dev.mysql.com/doc/refman/5.0/en/federated-limitations.html

volatilsis
This looks really interesting :)
BlaM