Dreaded Access Denied With a strange twist
am 04.01.2005 20:22:44 von Sam Boles------_=_NextPart_001_01C4F292.C3F641EF
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Whenever I try to connect to the MySQL database server using a PHP =
script, I am getting the infamous Access denied message:
=20
Error 1045:Access denied for user '
user_name'@'host_name' (using password: YES) (names have been changed =
to protect my server).
=20
The thing that is weird is that I am only getting this problem when =
trying to connect via PHP's built in mysql or mysqli functions (both =
php_mysql.dll and php_mysqli.dll are equally non responsive). ODBC =
(including ODBC via PHP), mysql clients (including the command line =
client as well as the graphic clients MySQL CC and MySQL Administrator) =
and even MySQL PHP Administrator works perfectly--nary a hiccup.
=20
Server environment is:
Apache/2.0.52 (Win32) PHP/5.0.3=20
MySQL client API version 4.1.7
MySQL version 4.1.7 -nt
Windows 2000 Server Service Pack 4
=20
Note that MySQL runs on the default port, but Apache runs on a =
non-standard port. Also, the database/web server machine is for an =
intranet and is accessible only from within the network (its IP address =
is non-routable and there is no NAT that leads directly to this =
machine).
=20
I have gone through and tried all the options in the FAQ's, mail lists =
and expert forums, and have Googled until my fingers are blue. =20
=20
I can tell you reasonably well what the issue is not:
=20
It is not a long- vs.. short- password issue, since this happens with =
Old Passwords on and Old Passwords off.
It is also not a user/password issue, since this is exclusive to PHP =
"direct" connections. ODBC and mysql clients work perfectly.
It is not an issue with the server not running, as I have ASP pages that =
access the data via ODBC connections and interact with several databases =
using the same username/password combinations that do not work here.
It may be the mysqllib.dll, but I have tried several versions of this =
library--both the one that came with PHP 5 and the one that shipped with =
MySQL 4.1.7. Both are equally non-responsive. And, Apache/PHP starts =
quite well, (initially I got the library not found error, but corrected =
this by putting mysqllib.dll in the system32 folder).
It is not a permissions issue, as the username/password combination that =
will not connect via PHP has full permissions and can (and does) =
exercise most of them when connecting via any of the other methods =
listed earlier--including the command line client.
=20
To put it bluntly, I am bamboozled. I have tried everything I can find =
in the mail lists, Google, manuals and online support. Any suggestions =
that might resolve this would be appreciated.
=20
If you want to see it, my script code (that does not work) is as follows =
(again, names modified for security):
=20
For the php_mysql.dll version:
=20
//phpinfo();
if(!($dblink =3D mysql_pconnect ("localhost","user_name","password")))
{
print ("Could not connect to the server!
\n");
print (mysql_errno().":".mysql_error() ."
\n");
exit();
}
else
{
print ("Yahoo!
\n");
}
mysql_select_db ("dbname",$dblink);
=20
?>
=20
The php_mysqli.dll version:
$mysqli =3D new mysqli("localhost", "user_name", "password");
=20
/* check connection */=20
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
=20
printf("Host information: %s\n", $mysqli->host_info);
=20
/* close connection */
$mysqli->close();
?>
=20
Thanks.
=20
We've moved! The Atlanta Community Food Bank has moved into its new home =
on Joseph E. Lowery Boulevard, adjacent to our former Jefferson Street =
warehouse. Please note changes to my address and telephone extension =
below.
Sam Boles =20
Database and Web Administrator=20
Atlanta Community Food Bank=20
25 Years of Nourishing Stronger Communities=20
Atlanta Community Food Bank=20
25 Years of Nourishing Stronger Communities =20
732 Joseph E. Lowery Blvd., Atlanta, GA 30318-6628 =20
ph: 404-892-3333 ext 1220 direct: 678.553.5940 fax: =
678.553.5941=20
Atlanta's Table Hunger Walk Product Rescue Center=20
Community Gardening TACK Hunger 101 Kids in =
Need=20
=20
------_=_NextPart_001_01C4F292.C3F641EF--