umen242
02-15-2008, 09:23 AM
Hello all
first i like to say that i was searching all google to find answer but with no lock.
i installed apache 2.2 + mysql 5 + php 5.2 on win2k
i changed the mysql port to be 3307 and also changed the parameter in the php.ini mysqli.default_port = 3307
mySql is running fine , im doing telnet localhost 3307 and getting connected .
i added the php/ext/extras into the path
now i like to test the connection from apache php to mysql but getting this error :
Fri Feb 15 09:55:32 2008] [error] [client 127.0.0.1] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'localhost' (10061) in H:\\Apache2.2\\htdocs\\dbtest.php on line 9
my php code looks like this :
<?php
// hostname or ip of server (for local testing, localhost should work)
$dbServer='localhost';
// username and password to log onto db server
$dbUser='root';
$dbPass='root';
// name of database
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect");
print "Connected successfully<br>";
mysql_close($link);
?>
why im getting this error all the time?
first i like to say that i was searching all google to find answer but with no lock.
i installed apache 2.2 + mysql 5 + php 5.2 on win2k
i changed the mysql port to be 3307 and also changed the parameter in the php.ini mysqli.default_port = 3307
mySql is running fine , im doing telnet localhost 3307 and getting connected .
i added the php/ext/extras into the path
now i like to test the connection from apache php to mysql but getting this error :
Fri Feb 15 09:55:32 2008] [error] [client 127.0.0.1] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'localhost' (10061) in H:\\Apache2.2\\htdocs\\dbtest.php on line 9
my php code looks like this :
<?php
// hostname or ip of server (for local testing, localhost should work)
$dbServer='localhost';
// username and password to log onto db server
$dbUser='root';
$dbPass='root';
// name of database
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect");
print "Connected successfully<br>";
mysql_close($link);
?>
why im getting this error all the time?