用户'root'@'localhost'拒绝访问(使用密码:YES)(Mysql :: Error) [英] Access denied for user 'root'@'localhost' (using password: YES) (Mysql::Error)

查看:333
本文介绍了用户'root'@'localhost'拒绝访问(使用密码:YES)(Mysql :: Error)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的服务器上部署Web应用程序,我得到这个mysql数据库异常
用户'root'@ accesshost'拒绝访问(使用密码:YES)(Mysql :: Error)

I tried to deploy web application on my server and I am getting this mysql database exception "Access denied for user 'root'@'localhost' (using password: YES) (Mysql::Error)"

我尝试使用 mysql -u root -p 从命令提示符访问数据库我能够完成所有操作数据库操作。

I tried to access the database from the command prompt using mysql -u root -p I am able to do all the database operations.

错误是什么

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3649)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1176)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2558)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager.java:620)
    at java.sql.DriverManager.getConnection(DriverManager.java:200)
    at com.mpigeon.DbConnection.DbConn(DbConnection.java:26)
    at com.mpigeon.CheckLoginHome.doGet(CheckLoginHome.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


推荐答案

您需要从localhost授予对root用户的访问权限。查看 ubuntu帮助

You need to grant access to root from localhost. Check this ubuntu help

这篇关于用户'root'@'localhost'拒绝访问(使用密码:YES)(Mysql :: Error)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆