解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

这个错误是新手经常会遇到的,本文主要介绍如何修复ERROR 2003 (HY000): Can't connect to MySQL server on ‘localhost' (10061)
解决方案:
1、登录到安装Mysql的主机,打开cmd命令行工具,执行命令mysql -uroot -p,报出下面所描述的错误;

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第1张图片

2、在开始菜单中找到计算机管理,在计算机管理中找到【服务】,在服务检查是否存在Mysql服务;

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第2张图片

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第3张图片

3、如果【步骤2】中找不到Mysql服务需要手动安装Mysql服务,安装命令为mysqld -install,由于本机中已经安装了mysql服务,所以有如下提示The service already exists!

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第4张图片

4、如果【步骤2】中能够找到Mysql服务,双击此服务查看服务的当前状态,如果没有运行,点击【启动】运行服务;

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第5张图片

5、此外,还可以通过在cmd中执行命令net start mysql命令来启动Mysql服务;

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第6张图片

6、Mysql服务启动成功后再次执行【步骤1】中的命令,便可正常连接到Mysql数据库了。

解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_第7张图片

到此这篇关于解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)的文章就介绍到这了,更多相关MySql报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

你可能感兴趣的:(解决MySQL启动报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061))