MySQL: SELECT from another server

Solution 1:

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/en/federated-storage-engine.html http://dev.mysql.com/doc/refman/en/federated-usagenotes.html

Solution 2:

CREATE TABLE `remote_table`(
  `foo` VARCHAR(100),
  UNIQUE KEY(`foo`(30))
) ENGINE=FEDERATED CONNECTION='mysql://thedomain.com:3306/remotedbname/remotetablename';

Then query it like any other table with SELECT, UPDATE, INSERT, DELETE.