Wednesday, June 17, 2009

The reason why PHP Can't connect to MySQL server on 'localhost'

If you can access the server from the command line with a mysql command issued without parameters then there is a good chance the server is configured to use a local socket or pipe on windows, so you need to specify this socket when connecting.

On Windows it's as simple as this: mysql_connect(".")

No comments:

Post a Comment