PS C:\WINDOWS\system32> net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
PS C:\WINDOWS\system32> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
PS C:\WINDOWS\system32> mysql -u root -p
Enter password:
ERROR 1045(28000): Access denied for user 'root'@'localhost'(using password: NO)
PS C:\WINDOWS\system32> net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
PS C:\WINDOWS\system32> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.60 MySQL Community Server (GPL)
Copyright (c)2000, 2018, 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.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> update user setpassword=password("新密码") where user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> quit
Bye
Access denied for user ‘root‘@‘localhost‘ (using password: YES)
Navicat for MySQL的连接错误在使用Navicat链接数据库时出现报错如图我们可以看出这个错误是出现在密码上的(可能你不记得了,可能密码设置时出问题了),因此我们要修改密码。1.首先打开MySQL的安装目录,找到my.ini文件并以记事本的形式打开,之后查找[[mysqld]]并在其后加上skip-grant-tables,保存且不关闭该文件。2.以管理员形式打开cmd.exe。操作如下:PS C:\WINDOWS\system32> net stop mysqlMySQL