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

时间:2021-08-06 03:47:00

一、分析问题:

    1.由提示可知mysql服务器未与本地服务器连接;

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

二、解决问题:

    1.右键点击我的电脑 → 管理 → 服务与应用 → 服务 → MySql → 启动

    (如果嫌每次重新启动麻烦可以把启动类型设为自动);

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

    2.上述配置设置完毕后,若依旧出现<10061>错误,检查可执行文件的路径是否是你MySql安装的路径;

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

    3.可执行文件的路径默认为C:\Program Files\MySQL\MySQL Server 5.6\mysqld,需要修改可执行文件的路径

        3.1 停止MySql服务器

        3.2 运行 → regedit,根据路径 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySql\ImagePath

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

            3.3右键点击ImagePath更改数值数据(V):"路径\bin\mysqld" MySQL

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


        4.然后运行 cmd → mysql -uroot -p 运行成功;

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