Bug #52434 [Com]: mysqlnd: host cannot be "localhost" when connecting to tcp port

From: Date: Wed, 10 Oct 2012 18:21:47 +0000
Subject: Bug #52434 [Com]: mysqlnd: host cannot be "localhost" when connecting to tcp port
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173997@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52434&edit=1

 ID:                 52434
 Comment by:         register at bazanov dot net
 Reported by:        anthon dot pang at gmail dot com
 Summary:            mysqlnd: host cannot be "localhost" when connecting
                     to tcp port
 Status:             Not a bug
 Type:               Bug
 Package:            MySQL related
 Operating System:   Ubuntu 10.04
 PHP Version:        5.3.3
 Block user comment: N
 Private report:     N

 New Comment:

Athon!
Thank you very much for bringing this BUG out!
I killed 1-2 hours of my time trying to understand why I can't connect to the server.
Then I found this bug report and changed localhost to 127.0.0.1 and it worked!

This is one of the most annoying and frustrating bugs ever. It must be fixed!

For search engines, here is the error I got:
Warning: mysqli_real_connect() ... [2002] ... connection refused. (trying to connect via
tcp://localhost:3306)
Warning: mysqli_real_connect() ... (HY000/2002) ... connection refused. (trying to connect via
tcp://localhost:3306)


Previous Comments:
------------------------------------------------------------------------
[2010-09-17 04:59:19] neweracracker at gmail dot com

I agree with anthon.

Someone has to fix this :)

------------------------------------------------------------------------
[2010-09-17 04:15:28] anthon dot pang at gmail dot com

This doesn't have anything to do with the hosts file or DNS resolution.

mysqlnd (rightly or wrongly) specially interprets "localhost" to mean a local 
socket, to mimic some of the behavior of MySQL command-line utilities.

------------------------------------------------------------------------
[2010-09-17 03:50:57] neweracracker at gmail dot com

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

Its disabled :)
Still no result hmm.

I blame Microsoft for this. lol

------------------------------------------------------------------------
[2010-09-16 23:30:01] pajoye@php.net

There are dozen of reports about that on Windows and it is unrelated to this problem.

A work around for the windows issue will be present in 5.3.4, in the meantime you can disable ::1 in
your windows' host file.

------------------------------------------------------------------------
[2010-09-16 23:01:03] neweracracker at gmail dot com

Hello.

I am able to reproduce this issue with:

Windows 7 build 7600 (Ultimate Edition) x86
PHP Version 5.3.3 MSVC6
mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ 
MySQL 5.1.50

Steps to reproduce:
1. Download phpmyadmin
2. Extract on html/www/public_html (or similar)
3. Try to connect to mysql (example: login)
4. It won't work, stop php
5. Edit config.inc.php and change localhost to 127.0.0.1
6. No more errors. I guess this needs a fix

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=52434


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52434&edit=1


Thread (12 messages)

« previous php.bugs (#173997) next »