PDA

View Full Version : Unable to connect to Mysql from php script.


manu
06-11-2002, 10:41 PM
Dear All,
I hv a small problem and i really hope you guys can help me out. Ok here i go:

Initially i had my web server and mysql server located locally(ip 202.157.188.2), and i used the following code to connect without any problem :

$dbhost = "localhost";
$dbname = "testdb";
$dbuser = "testuser";
$dbpassword = "testpwd";
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
if(!$db)
{
echo"Could not connect to database";
exit;
}

now my web server is located at 202.157.137.97 and mysql server at 202.157.188.2 i tried connecting to mysql using :

$dbhost = "202.157.188.2"; instead of localhost

but i'm getting this error msg :
MySQL Connection Failed: Can't connect to MySQL server on '202.157.188.2' (61)

does it mean tht the way i'm trying to connect is wrong ?

i hv a host in mysql user table as 202.157.188.2 with all grants .

please help me out.
thank you very much.

manu