Answers for "access denied for user 'root'@'localhost' in mysql workbench"

SQL
1

mysql workbench failed to connect with user root access denied ubuntu

The solution that worked for me was that

I had to create a new user apart from the root user (in mysql)
And then created a new db connection with admin as the user & then it worked
To create  a new user named admin with password as 'password'

commands-
sudo mysql -u root -p
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

if everything works- ENJOY!

At some point if you get an error like 
'Your password does not satisfy the current policy requirements'

do this-
(affter starting mysql)

commands-
SHOW VARIABLES LIKE 'validate_password%';

The output should be something like that :
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name    | ON    |
| validate_password.dictionary_file    |       |
| validate_password.length             | 6     |
| validate_password.mixed_case_count   | 1     |
| validate_password.number_count       | 1     |
| validate_password.policy             | LOW   |
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+


if not same 
do this-

SET GLOBAL validate_password.length = 6;
SET GLOBAL validate_password.number_count = 0;

similarly you can set other fields with the same format
just change the variable name that is to be set.

DONE!
THANKS :)

References-
https://askubuntu.com/questions/773446/unable-to-connect-via-mysql-workbench-to-localhost-in-ubuntu-16-04-passwordless
https://stackoverflow.com/questions/43094726/your-password-does-not-satisfy-the-current-policy-requirements
Posted by: Guest on August-16-2021

Code answers related to "access denied for user 'root'@'localhost' in mysql workbench"

Code answers related to "SQL"

Browse Popular Code Answers by Language