问答详情
源自:2-2 JDBC实战---打通数据库

总是显示这种错误怎么解决?

Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)

at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421)

at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)

at com.mysql.jdbc.Connection.<init>(Connection.java:1555)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)

at java.sql.DriverManager.getConnection(DriverManager.java:579)

at java.sql.DriverManager.getConnection(DriverManager.java:221)

at com.imooc.db.DBUtil.main(DBUtil.java:20)


提问者:紫川秀1 2016-12-27 17:16

个回答

  • 小铃铛L
    2016-12-27 22:44:10

    是不是在connection的时候忘记输密码了?