PHP/MySQL Access Denied
| From: | Tod B. Schmidt | Date: | Mon, 06 Jun 2005 21:06:07 +0000 |
| Subject: | PHP/MySQL Access Denied | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39618@lists.php.net to get a copy of this message | ||
Everybody's favorite problem but this one is strange. I can connect to my mysql 4.1.7 database
fine from the command line, but php won't connect no matter what I try, I always get the same
error.
Here is the script
<?php
$link = mysql_connect("localhost:3306", "xoops", "notmypassword" );
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysql_error());
exit();
}
/* close connection */
$mysql->close();
?>
This is what I get, doesn't matter what username/password I use, or whether I use a socket or
TCP/IP to connect.
Access denied for user 'root'@'localhost' (using password: NO)
I find it annoying that it insists I am trying to connect as root with no password, when that is not
the case. I know about the 4.1 password issues and that should not have anything to do with this
error. It also does this if I set the passwords to NULL in the script and database.
Anyone have any help for me?
Tod Schmidt
System Administrator
The Nature Conservancy
tschmidt@tnc.org
(703) 841-2028 (Phone)
(703) 276-0713 (Fax)