mysql服务忽然挂了,出现错误信息: Can’t connect to MySQL server on ‘localhost’ (10061)

报错信息:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

1查看服务中有没有启动服务

发现没有MySQL服务

2.手动安装mysql服务

cmd命令打开,在mysql安装的bin目录下面执行:

  >>>  mysqld --install       (注意这里一定是"mysqld",不是"mysql")

报错,信息如下:

  Install/Remove of the Service Denied

解决办法:

  打开cmd ,以管理员运行即可。
  当出现:Service successfully installed. 表示服务安装成功。

3.启动服务

两种方式:

  1.在windows服务中找到mysql,右键启动服务;

  2.使用命令启动     net start mysql

4.登录

  

C:Users12863>mysql -u root -p           
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 14
Server version: 5.7.11 MySQL Community Server (GPL)             (版本号)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

原文地址:https://www.cnblogs.com/vhviqd/p/11797180.html