Forum Moderators: coopster

Message Too Old, No Replies

Connect to MySQL.on a different computer?

I need to know how to connect to MySQL from a different computer.

         

chuckd

3:31 pm on Feb 27, 2006 (gmt 0)

10+ Year Member



I have an Dell 2400 with SuSE 9.3, Apache 2.0.54, and another server on the network, Windows XP SP2, and MySQL 5.0. If I run this script from a website:
<php
$username = "<whatever>";
$password = "<whatever>";
$hostname = "<WHAT GOES HERE?>";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to Mysql");
print "Connected";
?>

What do I put for the host name?
Do I put the local ip address?

thanks

bcolflesh

3:34 pm on Feb 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put the remote MySQL server's IP addy in there - you may need to append the port as well.

chuckd

3:50 pm on Feb 27, 2006 (gmt 0)

10+ Year Member



Port 3306, Right?

SeanW

3:52 pm on Feb 27, 2006 (gmt 0)

10+ Year Member



You'll be fine without specifying the port, as long as it's the default of 3306.

Also remember that mySQL's security is host based in addition to username and passwords. That is, a user configured on your DB server may be able to connect locally, but not remotely. Check the host field in the user and db tables for the user and db to make sure it's allowed in.

Sean