|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-23 15:50 UTC] jr-php at quo dot to
After upgrading from PHP 4.1.2 to PHP 4.2.0, MySQL connections fail with this error:
Warning: Access denied for user: 'username@my.fully.qualified.name'
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 17:00:02 2025 UTC |
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.