This error usually means there is a problem with the MySQL install and the location of the sock file. Something that I have suggested to other users that has worked for them is to use the loopback address rather than localhost in the connection file. This should establish the connection to the db via the network rather than through the local sock file.
So where you are specifying localhost for the host you should instead use 127.0.0.1. Please try this out and post back with your result.