There are a variety of reasons why this can happen, and rather than spell them all out with the hopes that one will stick, I'll refer you to http://dev.mysql.com/doc/mysql/en/can-not-connect-to-server.html in the MySQL Online Reference Manual.
In a nutshell, make sure the server is running, make sure the post is not firewalled, and if connecting with unix sockets, make sure the socket file has permissions for writing.
Dig Deeper on Open source databases
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.