StoreDocumentationSpecialsLatest PostsContactDownloadsOther Stuff

Ubuntu Mysql PHP Error 2002: Connection Refused

If you have a problem connecting to a mysql database using php; there's a lot of information available about the server not running, not using the correct password, etc. If you're an experienced user you know how to check these things.

But the Ubuntu instructions tell you to set the bind address to the IP address of the machine.

bind-address = 192.168.11.1

However if you do this, you will not be able to connect to the server from the local system because mysql is operating on the network. To allow php to connect locally, you need to bind to the localhost address.

bind-address = 127.0.0.1