-2
I’ve tried some solutions, I’ve reinstalled Mysql and Workbench, but it doesn’t seem to accept my password. It just keeps giving the same error. Note: I did not change the user name in the database, I left as default. This is happening after I try to run this class:
public class Conexao {
public static final String SERVIDOR = "jdbc:mysql://localhost/bdJava";
public static final String USUARIO = "root";
public static final String SENHA = "123456";
public Connection getConexao() {
try {
return DriverManager.getConnection(SERVIDOR, USUARIO, SENHA);
}catch (Exception e) {
throw new RuntimeException(e);
}
} }
Error shown in console:
Exception in thread "main" java.sql.Sqlexception: Access denied for '@localhost' user (using password: NO) on com.mysql.Cj.jdbc.exceptions.SQLError.createSQLException (Sqlerror.java:129) in com.mysql.Cj.jdbc.exceptions.SQLError.createSQLException (Sqlerror.java:97) in com.mysql.Cj.jdbc.exceptions.SQLExceptionsMapping.translateException (Sqlexceptionsmapping.java.jdbcl) in com.mysql.Cj.jdbc.exceptions.SQLExceptionsMapping.translateException (SQLExceptionsMapping.cjava.jdbcl. ConnectionImpl.createNewIO (Connectionimpl.java:836) in com.mysql.Cj.jdbc.Connectionimpl. (Connectionimpl.java:456) in com.mysql.Cj.jdbc.Connectionimpl.getInstance (Connectionimpl.java:246) com. mysql.cj.jdbc.NonRegisteringDriver.connect (Nonregisteringdriver.java:197) in java.sql.Drivermanager.getConnection (unknown source) in java.sql.Drivermanager.getConnection (unknown source) in com.mysql.Cj.jdbc.admin .TimezoneDump.main (Timezonedump.java:70)
when trying to exchange the password of the bank connection the error persists. there is a peculiar error that caught my attention, error: Exception in thread "main" java.sql.Sqlexception: Access denied to the user '' @ 'localhost' (using password: NO), it appears that the user is empty, but the user of my database is the default, which would be 'root''.