Welcome to WebmasterWorld Guest from 54.205.88.118

Forum Moderators: open

Connecting one MySQL server to another server

Data transfer from one MySQL server to another

   
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?
4:52 pm on Nov 7, 2011 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month