我在netbeans中連接了一個用於項目(java web應用程序)的MySQL數據庫。我以root身份創建了正確的登錄信息的MySQL服務器並創建了一個數據庫。我與我的數據庫的項目,但是當我運行的應用程序它顯示在瀏覽器中的錯誤:在日誌文件中對用戶'用戶'@'localhost'的MySQL訪問被拒絕(使用密碼:是)
type Exception report message Internal Server Error description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: java.sql.SQLException: Access denied for user 'User'@'localhost' (using password: YES) root cause java.sql.SQLException: Access denied for user 'User'@'localhost' (using password: YES) note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.
條目是:
java.sql.SQLException: Access denied for user 'User'@'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 com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1704) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1250) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2465) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2498) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:822) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at org.apache.jsp.Login_jsp.cn(Login_jsp.java:114) at org.apache.jsp.Login_jsp._jspService(Login_jsp.java:589) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
我在幾個累在其他一些形式中提到但不能使用的方式。
您沒有名稱爲「用戶」的用戶存在,如果它存在,則用戶帳戶不受密碼保護。首先嚐試連接數據庫與您在代碼中使用的UN和PW。 – Naman
@Naman。用戶創建肯定是因爲當我在用戶列表中看到它也顯示該名稱。 – krocks
你有沒有嘗試在MySQL使用該聯合國(用戶)及PW(你的PW)登錄? – Naman