views:

35

answers:

1

hi

is it possible to execute a SELECT command on a mysql host db2, being logined to mysql host db1?

e.g. i'm logined on mysql server db1, and i want to SELECT some data from db1 tables and db2 server tables with one query. i've found out that i can use FEDERATED tables, but i'm looking for a simpler way, if it exists

A: 

I do not think there is a simpler way. I can't find one, at least.
I did a bit or research on this. (Was interested.) The manual entry for the SELECT query mentions nothing that would allow it to connect to a database on a second server, and I can't see anything else that would allow it either. (Nothing in the JOINS, nothing in the CREATE TABLE syntax, just nothing...)

Except for the FEDERATED engine, that is. This is exactly why it was crated; to allow this sort of thing.

I suppose you could try to set your OS up to create a symbolic link to the data files of a second server and have the first server set up a table that targets that, but that's hardly an improvement over the FEDERATED engine.

In any case, if there are other alternatives, I doubt they are simpler than the FEDERATED engine. I would at least give it a try.

Atli