Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)
simply means that connection is not possible for one of the following (or similar) reasons:
1.There is no MySQL server running at the specified host
2.Connection to the MySQL server is not allowed using TCP-IP.
3. Some networking issue prevents connection.
4.When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked.
出错原因主要是这4个,一般首先看的是mysql服务有没开启。安装时默认开机就启动的,那就不用考虑,如果自己改动过的就要注意下,我自己是关掉的,要手动开启。