This is just a MySQL problem. You've got something messed up or set
incorrectly in your MySQL.user table. 

In the MySQL database, look at the user table. SELECT * FROM user. Look
at the Host and User columns. If you want to connect as root from the
same machine, only, then there should be only one row in there. Host
should be localhost, user should be root.

Can you send me a cut and paste of the Host and User columns of your
MySQL.user table? Just those two columns. It should be easy to figure
out without seeing them, though.... For example, my user table has only
these entries:

| Host      | User    |
| localhost | root    |
| localhost | 447sig  |
| localhost | user    |
| localhost | geeklog |

If you're trying to eliminate anonymous access, then there shouldn't be
any blank user entries. If you're trying to limit access to the same
machine, then there shouldn't be any % signs in the host column.

Have you read over the GRANT command in the MySQL manual? How did you
set up these users?

---John Holmes...

> -----Original Message-----
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 08, 2002 5:04 PM
> To: PHP-General Mailing List
> Subject: [PHP] mysql_connect()
> I posted this to the MySQL list as well, but haven't gotten an answer
> far. Just wonderin gif it may be a PHP problem I'm looking at. Anyway,
> this
> is the text of the message I posted to MySQL, with a few edits:
> I don't know if this is more of a PHP thing or a MySQL user issue that
> having trouble with.
> I have this code:
> /* Connecting, selecting database */
> $link = mysql_connect()
>       or die("Could not connect:" . mysql_error());
>       mysql_select_db("my_database") or die("Could not select
> I've gone through the MySQL manual step-by-step on how to remove the
> anonymous user (I'm using Win32) and add a password for the root user,
> then
> create other users. I also have read the PHP manual concerning the
> mysql_connect() function and use it accordingly, mysql_connect("host",
> "user", "pass")
> The problem is, when I put anything in the mysql_connect() function, I
> get:
> Access denied for user: 'user@host' (Using password: YES)
> Where user is whatever user I'm trying to connect with (have tried
> and
> host is my server - I've tried both localhost (which gives me "server
> found") and the actual hostname of my computer, which gives me the
> denied.
> The weird thing is, this works with -just- mysql_connect(), and the
> user/pass combos I'm using I use just fine to maintain and update the
> database, i.e. these are known good user/pass combos.
> Any idea what's happening?
> Jason Soza
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to