1、分析
Access denied 拒绝访问
using password: YES密码正确(No为错误)
2、解决办法
2.1、不使用密码直接进入数据库(不建议使用)
1、打开MySQL的my.ini文件,在文件的最后添加“skip-grant-tables”,保存
2、如果找不到my.ini文件,是因为隐藏了,输入%ProgramData%找到隐藏文件
也可以显示隐藏文件
在mysqlid后面添加skip-grant-tables
保存并关闭后,重启MySQL,再次运行项目试试
2.2、修改密码
1、进入数据库后
2、use mysql;
3、update user set password=PASSWORD(“111111”) where user=‘root’;
但是报错ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’
更改为 update mysql.user set authentication_string=password(‘111111’) where user='root’即可
4、删除my.ini文件的“skip-grant-tables”
5、重启服务器
问题,密码修改成功,但是数据库依然显示ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
set password for ‘root’@‘localhost’=password(‘111111’);
但是报错了。。。。
所以我先不改数据库的密码了了,去修改了web项目里的密码
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/newsmanagersystem?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username=root
password=111111