Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL connect on another server

Status
Not open for further replies.

wuz

Programmer
Jul 10, 2000
18
0
0
US
Does anyone know if there is an easy way to connect to a database that is outside the server?

In other words, I have a mySQL database on server #1 that I can access just fine with PHP, on several domains that use that server. But I also want to call that database from server #2 and display the database content. Obviously using "localhost" in the mysql_connect statement as the host name isn't going to work here. Is it possible to use a domain name for the host name (and if so, how would I go about finding the mySQL URL on a commercial web host)? Or is there another function or method I can use to access these files? I know I can do it with frames but thought there might be a way to do it without them. Any thoughts would be greatly appreciated. :)

Susan
 
when you do your connection, you can use a domain name or (preferably) an IP address, also you MUST use the port number - by default this is 3306 but can be changed, check with your administrator [lol]

mysql_connect($host:3306,$user,$password); ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top