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
https://forums.phpfreaks.com/topic/102002-connect-to-mysql-on-another-server/
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 ).

 

 

 

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.

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!

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.