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一下项目就可以连接了。
05-01
2万+
07-16
2488
11-13
3727
01-26
1031
09-09
1779
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交