homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Connecting one MySQL server to another server
Data transfer from one MySQL server to another

Msg#: 4383877 posted 7:58 pm on Nov 5, 2011 (gmt 0)

I am trying to write a query on one MySQL server to access data on another MySQL server. Any idea how to do it?

I tried with a query as below

Select * from hostnameB.DBname.table

Where this query was tried to execute on MySQL server with hostname A and table to access was on hostname B. It didn't work.
Is there any other way to do this?



WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4383877 posted 4:52 pm on Nov 7, 2011 (gmt 0)

Welcome aboard Dpkb, first you have to allow remote access from the remote server. Generally this is accessed via some control panel (Cpanel, WHM, Plesk), you enter the "allowed remote hosts." You'd turn remote access on and enter site A as (one of, there can be multiple) allowed remote host.

Next is to determine why "it doesn't work." Error trapping is critical for this, a simple PHP example,

$link = mysql_connect(DBHOST,DBUSER,DBPASSWORD,true) or die ("Could not connect to remote server" . mysql_error());

In your case, I'd expect "permission denied for user@localhost" or something similar.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved