homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

MySQL weird "access denied" problem
can't connect via PHP

5+ Year Member

Msg#: 3195066 posted 8:52 pm on Dec 20, 2006 (gmt 0)

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



WebmasterWorld Senior Member 10+ Year Member

Msg#: 3195066 posted 10:06 pm on Dec 20, 2006 (gmt 0)

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


5+ Year Member

Msg#: 3195066 posted 2:48 pm on Dec 21, 2006 (gmt 0)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved