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

后端 未结 5 1505
挽巷
挽巷 2021-01-21 14:15

I\'m having troubles with my project , it involves JDBC and Mysql connection .

When I do the following :

private Statement m_         


        
5条回答
  •  清歌不尽
    2021-01-21 14:55

    I encounter the same error, this is how I fixed it:

    I used DriverManager class like this:

        Class.forName("com.mysql.jdbc.Driver");
        Connection Hello = DriverManager.getConnection("jdbc:mysql://YOUR-URL-HERE", "USERNAME", "PASSWORD");
    

    And that's it. Also, when selecting a table, remenber to put the DB name first, like:

        "DB_NAME.TABLE_NAME".
    

提交回复
热议问题