在运行《hibernate开发与实战》blog源程序时,启动tomcat出现如下错误:
2011-04-01 10:37:38,359 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 0, SQLState: null
2011-04-01 10:37:38,359 ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
2011-04-01 10:37:38,359 WARN [org.hibernate.cfg.SettingsFactory] - Could not obtain connection metadata
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
……
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
... 50 more
原因: 配置文件中的用户名和密码不对(好好检查一下不仅仅是hibernate的配置文件中配置了,还有spring中也配置了)!好好看看配置文件,其中的默认的密码是test,我把mysql的密码改成test再次重启运行就可以了。
开始>运行>cmd
mysqladmin -u 用户名 password 新密码 -p
执行后提示输入旧密码,确认后即修改成功
重启就可以了。
在网上看了下,出现这种问题的情况好像不仅仅这一种原因,但是我建议还是要先仔细检查一下自己的配置文件~
Access denied for user 'root'@'localhost' (using password: YES)
原创文章标签 office,word 职场 休闲 《hibernate开发与实战》 blo 文章分类 办公效率

-
【LeetCode】39. 组合总和
【LeetCode】39. 组合总和
leetcode 数据结构与算法 C++ -
error: 'Access denied for user 'root'@'localhost' (using password: YES)'解决方法
# /etc/init.d/mysql stop# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &# mysql -u root mysqlmysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';mysql>
mysql error password where localhost