MySQL Forums
Forum List  »  Install & Repo

Re: MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: willians nogueira
Date: November 03, 2018 01:40PM

Peter,

those are the steps:

1a) from mysql-installer-community-8.0.13.0.msi installing Mysql with "Use legacy Authentication Method (Retain MySQL 5.x Compatibility);

1b) Standard System Account;


2) Entering the server with TOAD for MySQL, with Host : localhost, user : root, password : root. The connection was OK. No problem in entering.

3) Trought java app : no connection (MySQL ERROR 1045 (28000): java.sql.SQLException:Access denied for user...)

Statement used in java app used to trying to connect :=>
st = ConnectionDatabase.getConnection("localhost", "", "root", "root", "com.mysql.cj.jdbc.Driver").createStatement();

4) Creating a new user and flushing privileges :

User : Willians Password: abcdef

mysql> CREATE USER 'willians'@'localhost';
Query OK, 0 rows affected (0.10 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'willians'@'localhost';
Query OK, 0 rows affected (0.07 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)


5) entering server throught TOAD framework with Host : localhost, user : willians, password : 123456. The connection was OK. No problem in entering.

6) Again trought java app for the new user Willians : no connection ( java.sql.SQLException: Access denied for user 'willians'@'localhost' (using password: YES)

statement st used in java app to trying to connect :

st = ConnectionDatabase.getConnection("localhost", "", "willians", "abcdef", "com.mysql.cj.jdbc.Driver").createStatement();


7) VARIABLES YOU ASKED:

mysql> show variables like '%auth%';
+-------------------------------+-----------------------+
| Variable_name | Value |
+-------------------------------+-----------------------+
| default_authentication_plugin | mysql_native_password |
+-------------------------------+-----------------------+
1 row in set (0.00 sec)

mysql> select host, user, authentication_string from mysql.user;
+-----------+------------------+------------------------------------------------------------------------+
| host | user | authentication_string |
+-----------+------------------+------------------------------------------------------------------------+
| localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | willians | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 |
+-----------+------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)

That's the scenario. WHAT'S WRONG ? Thanks for helping.

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
November 03, 2018 01:40PM
January 06, 2019 07:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.