java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

错误:

java.sql.SQLException: Access denied for user ‘’@‘localhost’ (using password: YES)
This application has no explicit mapping for /error, so you are seeing this as a fallback.

问题出现:

在用springboot连接了数据库后,测试是否与数据库连通(通过主键查询学生信息)

核心代码:

  • application.properties

java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

  • controller
    java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
  • mapper
    java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
  • mapper.xml

java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

最后访问这个页面,浏览器提示如下错误
java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

解决办法

java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
是*本尊!!!