ID: 16768 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: MySQL related Operating System: Red Hat Linux 7.2 PHP Version: 4.2.0 New Comment:
As others have stated on the dev list, the problem seems to be that PHP 4.2.0 is trying to connect using TCP instead of using the UNIX socket. I can confirm that this is what's happening on my end too. With PHP 4.1.2, tcpdump shows no TCP traffic and everything works correctly. With PHP 4.2.0, tcpdump shows connections to the MySQL port (3306) and it doesn't work. In both PHP versions, MYSQL_SOCKET is set the same way according to phpinfo(): /var/lib/mysql/mysql.sock, which is correct for my system. And both PHP versions show the same configure output: checking for MySQL support... yes checking for MySQL UNIX socket... /var/lib/mysql/mysql.sock Previous Comments: ------------------------------------------------------------------------ [2002-04-23 17:25:48] [EMAIL PROTECTED] Hmm, I tested again and now I'm getting this slightly different message: Warning: Host 'my.fully.qualified.name' is not allowed to connect to this MySQL server Also, I found these calls result in the same error message: mysql_connect("127.0.0.1", "username", "password"); mysql_connect(":/var/lib/mysql/mysql.sock", "username", "password"); This can't be the correct behavior. When I connect to localhost, MySQL should "see" the PHP connection as being from localhost, NOT my machine's fully-qualified DNS name. This is what happens when I use the command-line "mysql" program, or any prior version of PHP (3.x - 4.1.2). This is a critical problem because it breaks all of my existing PHP scripts that use MySQL. I'm reluctant to start playing around with my MySQL permissions tables, because if/when this bug is addressed, I'd have to put everything back. So for now, I'm back to 4.1.2. ------------------------------------------------------------------------ [2002-04-23 15:50:29] [EMAIL PROTECTED] After upgrading from PHP 4.1.2 to PHP 4.2.0, MySQL connections fail with this error: Warning: Access denied for user: '[EMAIL PROTECTED]' Apparently, it is trying to connect to 'my.fully.qualified.name' instead of 'localhost' as before. This seems wrong because my mysql_connect() call uses 'localhost' as the host name: mysql_connect("localhost", "username", "password"); I can work around this by changing all my MySQL grants from 'username'@'localhost' to 'username'@'my.fully.qualified.name', but that seems unnecessary; this should be fixed in PHP. BTW, I've used the same above mysql_connect() call since the PHP 3.x days and it's always worked fine, until now. My PHP configure line: ./configure --with-apache=../apache_1.3.24 --enable-track-vars \ --with-mysql --with-zlib --with-gd All PHP configuration settings are defaults. (i.e. php.ini = php.ini-dist) Apache version is 1.3.24. MySQL version is 3.23.49a. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16768&edit=1