第一种方法打开电脑的服务列表,在那里可以看到你的所有服务的状态,具体请看我另一个帖子
第二种方法是在C:\Program Files\MySQL\MySQL Server 8.0\bin路径下,打开命令窗口
然后输入mysqladmin -uroot -p12345 ping然后回车
结果如下图,从图中可以看到上面说mysqld处于活动状态,这个mysqld就是mysql服务。
现在我们停用所有的mysql服务(如果停止服务请查看其他帖子)
然后我们再执行
mysqladmin -uroot -p12345 ping
就会提示:
C:\Users\Administrator>mysqladmin -uroot -p12345 ping
mysqladmin: [Warning] Using a password on the command line interface can be inse
cure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (10061)'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
如果你的mysql服务都没有启动,你像往常一样输入账号密码登录数据库的话,会提示
C:\Users\Administrator>mysql -uroot -p12345
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
如果要出现上面所说的错误提示,你首先想到的就是要启动mysql服务,具体怎么启动请看我的其他帖子