I recently upgraded my server software on my pc from PHP4 to PHP5 and MySQL 4.1 to MySQL 5.0 and I am having some problems connecting to MySQL via PHP.
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in C:\wwwroot\connection.php on line 2
Could not connect to MySQL at localhost.
Here is the code:
<?php
$link = mysql_connect("localhost", "root", "pass1234") or
die ("Could not connect to MySQL at localhost.");
mysql_select_db("mydb", $link) or
die ("Could not select database.");
echo "Connect success!";
?>
Server specs:
Windows XP SP2
Apache/2.2.3 (Win32) PHP/5.2.3
MySQL 5.0
The MySQL setup was a basic MSI install with default settings.
MySQL is running and I can connect via the command prompt with the same EXACT username and password I use in the script.
I've spent a few hours searching forums and google trying to find what the problem might be but I haven't been able to find anything useful.