|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51759 Same as bug #45150 (localhost ->
Submitted: 2010-05-06 21:43 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:9 of 9 (100.0%)
Same Version:8 (88.9%)
Same OS:3 (33.3%)
From: sed at sed dot is Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 5.3.2 OS: Windows 7 Ultimate 64bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sed at sed dot is
New email:
PHP Version: OS:


 [2010-05-06 21:43 UTC] sed at sed dot is
Same as bug #45150. I was not able to connect to MySQL via localhost though PHP found the mysql extension etc.
Finally, after 20 hours work, I found a website through Google that let me to a solution. To fix this I'll have to use "" instead of "localhost"
I'm using IIS7.5 on Windows 7 Ultimate 64bit
FastCGI (PHP 5.2.13 installer [20,929Kb] - 25 February 2010, md5: 891e3262428851ebe71d5432a97be6d5, with my own php.ini aftertouch)
MySQL 5.1.46-winx64
Using both IPv4 and IPv6
I can use localhost within MySQL command prompt, but not with PHP.

Test script:
// timeout
$host = "localhost";
$user = "root";
$password = "******";
$database = "******";
$mysql_link = mysql_connect( $host, $user, $password );

// timeout fixed
$host = "";
$user = "root";
$password = "******";
$database = "******";
$mysql_link = mysql_connect( $host, $user, $password );

Expected result:
Normal connection with mysql without timeout.

Actual result:
Timeout trying to connect via mysql_connect (Error: 2002)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-09 17:46 UTC] falcon_ia at hotmail dot com
After I updated php from 5.3.0 to 5.3.2,
mysql_connect cannot connect localhost but
It shows:
Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in ........

And drivers\etc\hosts seems good.
 [2010-06-27 13:43 UTC] therealloonylion at yahoo dot co dot uk
I have the same issue as falcon_ia at hotmail dot com. I upgraded 5.3.0 to 5.3.2 and php is no longer able to connect to Mysql. Mysql is working fine and my hosts file is correct.
 [2010-07-06 19:09 UTC]
-Status: Open +Status: Feedback
 [2010-07-06 19:09 UTC]
Check if this is your case, most probably it is.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 08:01:30 2024 UTC