Spring org.hibernate.exception.genericjdbception:无法打开连接]根本原因为java.sql.SQLException:

Spring org.hibernate.exception.genericjdbception:无法打开连接]根本原因为java.sql.SQLException:,spring,hibernate,Spring,Hibernate,你好,我还是spring和hibernate的新手,这是我第一个尝试连接到db的应用程序,但我收到了HTTP状态500的例外-请求处理失败;嵌套异常为org.hibernate.exception.genericjdbception:无法打开连接 在控制台中:org.hibernate.exception.genericjdbception:Cannot open connection],根本原因为java.sql.SQLException: 拒绝用户“root”@“localhost”的访问(

你好,我还是spring和hibernate的新手,这是我第一个尝试连接到db的应用程序,但我收到了HTTP状态500的例外-请求处理失败;嵌套异常为org.hibernate.exception.genericjdbception:无法打开连接 在控制台中:org.hibernate.exception.genericjdbception:Cannot open connection],根本原因为java.sql.SQLException: 拒绝用户“root”@“localhost”的访问(使用密码:是) 有人能帮我吗?我检查了与其他java应用程序的连接,它工作得非常好

数据库.properties

 database.driver=com.mysql.jdbc.Driver
  database.url=jdbc:mysql://localhost:3306/DAVDB
 database.user=root
 database.password=''
 hibernate.dialect=org.hibernate.dialect.MySQLDialect
 hibernate.show_sql=true
 hibernate.hbm2ddl.auto=update

您的database.properties不正确:

database.password=''
应该是:

database.password=

假设你想要一个空密码。引号在属性文件中没有特殊意义,因此它们将被视为文字。

感谢您的回答我按照您的建议对其进行了更改,但现在出现了一个新的异常“请求处理失败;嵌套异常为org.hibernate.exception.sqlgrammareexception:无法打开连接”事实上,我在一项研究后感到困惑,有建议检查hibernate.cfg文件,但我没有,我甚至不知道它是什么!!我没有在Spring中使用Hibernate,所以我不确定正确的方法是什么。也许这个问题可以帮助你:非常感谢你的帮助:)你好,我用一个朋友的电脑测试了我的代码,效果很好,但我认为问题出在我的数据库连接Aapache以及Mysql上,我不知道我的电脑出了什么问题!!任何帮助PLZZZ我认为错误可能是由于端口不同,因为我已将tomcat的端口更改为9000我想知道客户端是否正在侦听同一端口我怎么知道