Jump to content

Connect to MYSQL on another server


peterbz

Recommended Posts

I was wondering how you can connect to a MySQL database on another server if you have the username and password

 

What I want to do is to retrieve data from a table from a MySQL database on another server and update the data to another server.

 

I was just wondering if this is possible.

Link to comment
Share on other sites

Yes, you can specify the a different hostname in the '$server' argument in mysql_connect, connect to that server, get your data and then make another connection to your other server and insert/update the data.

 

http://us.php.net/mysql_connect

 

Or if you have access to the command line on a computer that has MySQL installed, you could do that using some of the mysql tools ( eg, mysql, mysqldump, etc ).

 

 

 

Link to comment
Share on other sites

But the server is 'localhost'. You need to find a public hostname for that server.

 

 

It's hard to get. You might have to really bother you webhosting company to get it. With the web hosting companies I've worked with, they have never given out their public SQL server hostname with out you having to ask for it.

Link to comment
Share on other sites

Yes, an IP address will work or anything that will give you an IP address.

 

If the server admin has allowed remote access to the DB server, he probably didn't put it on the same hostname as the webserver ( the address you see in your address bar ) or at least i"ve never seen it done this way. But it's worth a try!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.