问答详情
源自:8-3 DBHelper类设计

DBhelper类中报错,找了半天找不出bug,数据库已经启动,.....

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)

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

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

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

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

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

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

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

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

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at util.DBHelper.getConnection(DBHelper.java:34)

at util.DBHelper.main(DBHelper.java:44)


提问者:自明小友 2018-08-31 00:17

个回答

  • 杰KaMi
    2018-09-23 03:45:38

    视频中数据库没有密码,你看下你的数据库

  • swdmike
    2018-09-04 13:30:29

    jdbc的url格式不对?