Failed to obtain the JDBC Connection + Access denied for user 'XXX'@'localhost' (usi

Posted LeftBody

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to obtain the JDBC Connection + Access denied for user 'XXX'@'localhost' (usi相关的知识,希望对你有一定的参考价值。

如果你遇到的问题同时出现上面两种情况,且XXX的username是你主机名而非数据库用户名的情况,那么这篇博文也许对你有用

在db.properities【或其他名称,表示数据库连接参数】中需要使用jdbc.username而不可以是username,否则db获取的会是你的主机名【迷惑】

但是其他参数诸如driveClass或者url、password等则可以不需要添加前缀jdbc,修改成如下形式,或者保险起见就所有的参数都加上jbdc

 

 

最后不要忘记修改applicationContext的内容,把${username}修改为${jdbc.username}

 

 

大功告成!

 

以上是关于Failed to obtain the JDBC Connection + Access denied for user 'XXX'@'localhost' (usi的主要内容,如果未能解决你的问题,请参考以下文章

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection

druid数据源集成p6spy:Failed to obtain JDBC Connection: dbType not support : null

registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web applicat

elasticsearch failed to obtain node locks

failed to obtain in-memory shard lock

failed to obtain in-memory shard lock