mysql - java.sql.SQLException: Access denied for user root@localhost (using password: YES)

mysql – java.sql.SQLException: Access denied for user [email protected] (using password: YES)

mysql – java.sql.SQLException: Access denied for user [email protected] (using password: YES)

This can help you:

GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY %password% WITH GRANT OPTION;

Execute it with command line or some GUI tool.

Dont forget to replace %password% with real password.

As you are creating a database from scratch, you could use:

Connection connection = DriverManager.getConnection(jdbc:mysql://localhost/?user=root&password=rootpassword); 
PreparedStatement ps = connection.prepareStatement(CREATE DATABASE databasename);
int result = ps.executeUpdate();

Here is an identical scenario.

mysql – java.sql.SQLException: Access denied for user [email protected] (using password: YES)

This is specific to Ubuntu 18.04 LTS and MySQL 5.x
Followed this link
Follow everything from here onwards:

sudo mysql_secure_installation

sudo mysql

Once logged into MySQL then from the MySQL prompt execute these commands:

ALTER USER [email protected] IDENTIFIED WITH mysql_native_password BY password;
FLUSH PRIVILEGES;

Now verify that the table has the password for the root

SELECT user,authentication_string,plugin,host FROM mysql.user;

This solved my issue and now i am able to login.

Related posts on my sql :

Leave a Reply

Your email address will not be published.