Home >Database >Mysql Tutorial >Why Am I Still Getting 'Exception in thread 'main' java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)'?
Issue:
The Java program is encountering a SQL exception indicating that the user connecting to the MySQL database does not have permission to access the data. Despite attempts to modify user permissions and password, the error persists.
Answer:
It is likely that Eclipse is not running the intended MainApp class, which is the source of the SQL query. Instead, it is running a different class (com.mysql.cj.jdbc.admin.TimezoneDump) that also contains a main method.
Solution:
To resolve this issue:
This will launch the MainApp class and resolve the SQL exception caused by incorrect user permission or an invalid connection attempt.
The above is the detailed content of Why Am I Still Getting 'Exception in thread 'main' java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)'?. For more information, please follow other related articles on the PHP Chinese website!