Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

MySQL weird "access denied" problem

can't connect via PHP



8:52 pm on Dec 20, 2006 (gmt 0)

10+ Year Member

When I set up a new user, I can't connect to the MySQL databse via PHP. It gives me:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'example'@'localhost' (using password: YES) in connect-test.php on line 32

The problem is that using the same username and password in 2 different MySQL management tools it connects just fine. It is only through PHP that the authorization fails. What could cause this?

I have even tried changing the password to "OLD_PASSWORD" and even tried it non-encrypted "in the clear" for testing purposes. I really am stumped with this one!

-- Zak


10:06 pm on Dec 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Make sure localhost is in the list of allowable domains from which to accept connections.


2:48 pm on Dec 21, 2006 (gmt 0)

10+ Year Member

I found that if I create a new user with localhost as the domain instead of %, it works. So I am guessing that localhost isn't included in %? If that's the case, how can I get it to be, or do I have to create duplicate users: One with % as the domain and one with localhost as the domain?

-- Zak


Featured Threads

Hot Threads This Week

Hot Threads This Month