ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)---mysql数据库本地服务器localhost连接失败

出现错误mysql数据库本地服务器localhost连接失败:

 1、输入命令 mysql -uroot -p 

  输入密码进入数据库发现错误

2、输入命令 mysqld --install

  出现Service successfully installed. 命令执行成功

3、输入命令 net start mysql

  出现

  MySQL 服务正在启动 .
  MySQL 服务已经启动成功。

  命令执行成功

再次连接发现成功!

附:

Access denied for user 'root'@'localhost' (using password: YES)错误:

1、use mysql; 使用数据库

2、输入命令:update mysql.user set authentication_string=password('root') where user='root' ;

3、刷新: flush privileges;

原文地址:https://www.cnblogs.com/rainbow-1/p/14836171.html