C:\Users\Administrator>mysql -uroot -proot
            ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061)
            C:\Users\Administrator>net start mysql
            服务名无效。
            E:\MariaDB\bin>mysql -u root -p
            Enter password: ****
            ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061)
            E:\MariaDB\bin>mysqld -install mysql
            Service successfully installed.        
            E:\MariaDB\bin>net start mysql
            mysql 服务正在启动 ..
            mysql 服务已经启动成功。
            E:\MariaDB\bin>mysql -uroot -proot
            Welcome to the MariaDB monitor.  Commands end with ; or \g.
            Your MariaDB connection id is 8
            Server version: 10.3.7-MariaDB mariadb.org binary distribution
            Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
            Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
            MariaDB [(none)]>quit
            Bye
            E:\MariaDB\bin>c:
            C:\Users\Administrator>mysql -uroot -proot
            Welcome to the MariaDB monitor.  Commands end with ; or \g.
            Your MariaDB connection id is 14
            Server version: 10.3.7-MariaDB mariadb.org binary distribution
            Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
            Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
            MariaDB [(none)]>
 

ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

    如果用navicat软件进行mysql连接会出现:
    ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
    解决办法是一样的。
 

        登录出现上面错误,可以试着启动mysql服务,但是发现出现服务名无效,基本就是
    服务中没有mysql。
        cmd通过mysqld -install mysql命令进行mysql安装,当看到mysql服务成功启动,
    已经成功了一半了,此时登录你会发现mysql可以成功登录。
        但必须是在mysql的路径下登录,退出cmd重新登录,你会发现又会报mysql不是内部
    或外部命令,其实这种情况将mysql的路径在环境变量中配置就会解决,然后mysql在那
    个路径下都可以登录。
 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐