ID: 31220 Updated by: [EMAIL PROTECTED] Reported By: bc at default dot co dot yu -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Linux 2.4 PHP Version: 4.3.10 New Comment:
RTFM: http://www.php.net/mysql_connect "Note: Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket..." Read the rest from the manual page.. Previous Comments: ------------------------------------------------------------------------ [2004-12-21 06:19:23] bc at default dot co dot yu Description: ------------ I'm using recent 4.3.10 release with mysql 4.1 client libs. I have a configuration of 2 servers. One is the MySQL database, another is apache 1.3 running PHP 4.3.10 through CGI/FastCGI interface. All scripts are using "localhost" value in mysql_connect() function. Actually that connection is being NAT'ed with iptables to MySQL server. When I do manual connect with telnet to localhost:3306 it works fine. Also if "localhost" is changed to "127.0.0.1" or direct IP of MySQL host ( 10.1.5.55 in this case ) it just works fine! *But* when is "localhost" in mysql_connect() it simply does NOT work! Reproduce code: --------------- I keep getting this: Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) keep in mind that I *am* providing the password: $db = mysql_connect("localhost", "$db_username", $db_password); this is my /etc/hosts file: 127.0.0.1 localhost localhost.localdomain BTW, I've tried all the combinations: 127.0.0.1 localhost or: 127.0.0.1 localhost.localdomain ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31220&edit=1