I was using mysql 5.6.11,it usually turned down and show me this:
2005 - Unknown MySQL server host \'localhost\'(11001).
Current
The case is like :
mysql connects will localhost when network is not up.
mysql cannot connect when network is up.
You can try the following steps to diagnose and resolve the issue (my guess is that some other service is blocking port on which mysql is hosted):
This should ideally resolve the issue you are facing.