Jump to content


Photo

connect to mysql on one server from another


  • Please log in to reply
1 reply to this topic

#1 slancasterfreak

slancasterfreak
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 01 April 2006 - 05:31 PM

I have connected to my MySQL database before using:

$db_connect=mysql_connect("localhost","dogbones","jdhkjn7676") or die ("Could not connect to database");
mysql_select_db("$db") or die ("Could not select database");


before, but what if I want to connect to it from another website, would I do something like:

$db_connect=mysql_connect("http://www.thisother...s","jdhkjn7676") or die ("Could not connect to database");
mysql_select_db("$db") or die ("Could not select database");


Would that work, or do I need some "port" or "socket" thing or numerical IP address in there or what?

Thanks in advance!!!

Sally
www.family-gathering.org

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 01 April 2006 - 05:42 PM

To connect to a remote server you will need either the IP address of the server of the domain name of the site the server is installed on aswell as the a port number which is 3306 by defualt. SO i order to connect to a remote mysql server you'll do this:
mysql_connect("example.com:3306", "userName", "passWord")





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users