At 12:28 -0600 1/7/03, Christensen, Dave wrote:
>You can use the command line mysql with the "host" option, i.e.
>--host=<hostname>, to connect to another machine. Likewise, you could set
>up a data source using ODBC to look at the database on the second host
>machine through which you could generate queries against the tables on the
>other host's database tables.
If I understood the initial question correctly, your first suggestion is not
what he wants. I think he's talking about accessing two servers from the same
connection, which is not possible:
Throughout this chapter, I've been making the implicit assumption that
all the tables involved in a multiple-table operation are managed by a
single MySQL server. If this assumption is invalid, the tables become more
difficult to work with. A connection to a MySQL server is specific to that
server. You can't write a SQL statement that refers to tables hosted by
another server. (I've seen claims that this can be done, but they always
turn out to have been made by people who haven't actually tried it.)
-- MySQL Cookbook, p671
>From: Paul DuBois [mailto:paul@stripped]
>Sent: Tuesday, January 07, 2003 11:12 AM
>To: Chris Boget; mysql@stripped
>Subject: Re: Query mysql on another server
>At 10:08 -0600 1/7/03, Chris Boget wrote:
>>We have a *nix network and on that network we have 2
>>web servers. One for development (server1) and one for production
>>(server2). And on each of those servers we have MySQL installed. Is
>>there a way we can query a table on server2 from server1?
>>I know that when you are using a database from the mysql command line,
>>you can query a table in another database just by using select
>>databasename.tablename. But the same method using servername doesn't
>>work. Is this even possible?