windows10 下 Navicat 连接 MySQL报错:
1045 - Access denied for user ‘root’@‘localhost’ (using password: YES)
可以看下截图:


1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql


1、先停止MySQL服务

​net stop mysql​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql数据库_02

2、编辑 MySQL安装目录 下的 ​​my.ini​

在 [mysqld] 下添加

​skip-grant-tables​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql数据库_03

3、启动MySQL服务

​net start mysql​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_数据库_04

4、登录MySQL(不需要输入密码)

​mysql -uroot -p​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_数据库_05

5、修改MySQL数据库root用户密码

5.1 使用mysql库

​use mysql;​

5.2 修改root密码

​update user set authentication_string=password('123465') where user = 'root';​

5.3 刷新生效

​flush privileges;​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql安装_06

6、关闭MySQL服务

​net stop mysql​

7、然后编辑 MySQL安装目录 下的 ​​my.ini​

在 [mysqld] 下删掉

​skip-grant-tables​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql_07

8、登录MySQL(需要输入密码)

​mysql -uroot -p​

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_mysql_08

9、Navicat连接MySQL数据库

1045 - Access denied for user ‘root‘@‘localhost‘ (using password: YES)_数据库_09

连接成功!