java.sql.SQLException: Access denied for user ‘kuber‘@‘localhost‘ (using password: YES)报错的解决方法

在进行spring整合的时候,使用连接池出现这个错误。
之所以出现这个错误是因为在db.properties中写了username=xxx
在这里插入图片描述
在这里插入图片描述

所以我会报错:
在这里插入图片描述
原因是username这个变量好像被jvm环境占用了,所以在spring-dao.xml中${username}取值得到的是jvm中username的值,

而不是db.properties中username的值,因此无法访问数据库。
将username改为user
在这里插入图片描述
在这里插入图片描述

再次测试
在这里插入图片描述
成功!

猜你喜欢

转载自blog.csdn.net/weixin_43215322/article/details/111412686
今日推荐