mysql connecting OK on 127.0.0.1 but not localhost

wxdqz

New Member
Hi,

Here's a strange one for you...

I have an existing PHP installation statically compiled into apache that connects to a mySQL database using "localhost".

I just created a new PHP/mysql CGI executable, and the same scripts no longer connect.

If I change mysql_connect("localhost", "username", "password") to mysql_connect("127.0.0.1", "username", "password") the scripts will work again.

gethostbyname("localhost") returns 127.0.0.1, so PHP can do the translation. It is as if mySQL is denying access...but the same mySQL server allows the same usernames in the same scripts running under the other PHP installation.

Any ideas are appreciated.

Scott
 
Back
Top