I am having the same problem and am getting pretty frustrated not being able to find a definitive answer to correct this. I assume that it is something simple, but I am at a loss.
mysqli_test.php is coded as follows:
<?php
$dbServer='localhost';
$dbUser='root';
$dbPass='pword';
$dbName='test';
$link = mysqli_connect($dbServer, $dbUser, $dbPass, $dbName) or die("Could not connect");
print "Connected successfully<br>";
mysql_close($link);
?>
The error:
Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can't connect to MySQL server on 'localhost' (10061) in C:\xampp\htdocs\mysqli_test.php on line 6
I am running Apache 2.2.9, PHP 5.2.6, and MySQL 5
MySqli and MySql are both enabled in php.ini.
I am able to successfully log into MySQL via MySqlAdmin command line, MySql Command line, and MySql Workbench as root and all the other users that I have created.
I am able to manually connect to all databases and tables using root and all the other users I have created with the correct permissions.
The Default Port for both MySql and MySqli are set to 3307 (confirmed via phpinfo())
In my PHP.ini file:
log_errors =On
display_errors = On
From my PHP Error Log File:
[04-Oct-2011 12:40:44]
PHP Warning: mysqli_connect()
[<a href='function.mysqli-connect'>function.mysqli-connect</a>]:
(HY000/2003): Can't connect to MySQL server on 'localhost' (10061)
in C:\xampp\htdocs\mysqli_test.php on line 11
Anything I am missing?