java.sql.SQLException:对于我的sql,用户'root'@'localhost'(使用密码:YES)拒绝访问

时间:2022-07-13 19:25:09

I tried to importing an existing project which consists of Spring mvc & Hibernate while running application through TOMCAT I'm having troubles with my project , it involves Hibernateand Mysql connection .

我尝试导入一个包含Spring mvc和Hibernate的现有项目,同时通过TOMCAT运行应用程序我遇到了我的项目问题,它涉及Hibernate和Mysql连接。

When I do the following :

当我执行以下操作时:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:925)
    at ..

1 个解决方案

#1


It looks like a privelege issue. Try to run this on your console

这看起来像一个privelege问题。尝试在您的控制台上运行它

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;

#1


It looks like a privelege issue. Try to run this on your console

这看起来像一个privelege问题。尝试在您的控制台上运行它

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;