MySQL Access denied for user 'xxx'@'localhost' while create connection in Java
By Joseph Russell •
There are user 'pawa' on my Ubuntu. When I try create Connection object with code:
Properties properties = new Properties();
properties.put("user", "root");
properties.put("password", "password");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/library_db@localhost");I get error like:
Caused by: java.sql.SQLException: Access denied for user 'pawa'@'localhost' (using password: NO)I dont understand why my user appear here? In properties I put root user. I give all permission to my user with
GRANT ALL PRIVILEGES ON library_db.* TO 'pawa'@'localhost';
FLUSH PRIVILEGES;but it doesnt work.
Edit to include screenshots supplied in comments: