Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ‘ro

Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ‘root’@‘localhost’ (using password: NO)
分析原因:没有用密码登陆root
1、我是有设置密码的,而且Navicat也能连接成功
2、配置文件没有语法错误,username和password编写正确
3、用户权限也都加了
但还是连接不上TAT
既然不要密码,那干脆把mysql的密码设置为空好了
我的mysql版本为5.7
在MySQL 5.7 password字段已从mysql.user表中删除,新的字段名是“authenticalion_string”.
打开命令行窗口,连接数据库
1、选择数据库:use mysql;
2、更新root的密码:update user set authentication_string=password(’’) where user=‘root’ and Host=‘localhost’;
3、刷新权限:flush privileges;
4、关闭数据库
mysql> shutdown;
再重新run一下项目就可以连接了。

猜你喜欢

转载自blog.csdn.net/weixin_46475607/article/details/123591041
今日推荐