Access denied for user 'root'@'localhost' (using password: YES)

Asked

Viewed 38 times

0

Good afternoon Guys, I’m trying to create a table using Hibernate in Java, the database used is Mariadb, but when compiling my Java class this error occurs below. I have already checked the class persistence.xml and put in the correct line the password, someone can help me?

Caused by: java.sql.Sqlexception: Access denied for user ?root'@?localhost' (using password: YES) at com.mysql.Cj.jdbc.exceptions.SQLError.createSQLException(Sqlerror.java:129) at com.mysql.Cj.jdbc.exceptions.SQLError.createSQLException(Sqlerror.java:97) at com.mysql.Cj.jdbc.exceptions.SQLExceptionsMapping.translateException(Sqlexceptionsmapping.java:122) at com.mysql.Cj.jdbc.Connectionimpl.createNewIO(Connectionimpl.java:836) at com.mysql.Cj.jdbc.Connectionimpl.(Connectionimpl.java:456) at com.mysql.Cj.jdbc.Connectionimpl.getInstance(Connectionimpl.java:246) at com.mysql.Cj.jdbc.Nonregisteringdriver.connect(Nonregisteringdriver.java:197) at org.hibernate.engine.jdbc.Connections.internal.Driverconnectioncreator.makeConnection(Driverconnectioncreator.java:38) ... 29 more

  • Also check that the user and password are correct.

  • Thanks for the help, I can solve the problem. Because there is 2 DBMS installed in my notebook, when installing the DBMS Mariadb he requested to change the TCP port, by default it is the 3306 installed, I changed to the next 3307 and missed insert in the URL line of the database in the localhost the TCP port in the file persistence.xml. < Property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3307/alura_jpa" />

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.