6

I'm working on Debian 8 and wanted to create database using MySQL Workbench. I did everything in this tutorial, but when I created a new MySQL Connection, the program returned:

Failed to Connect to MySQL at 127.0.0.1:3306 with user root, Access denied for user 'root'@'localhost' (using password: YES).

What am I doing wrong? I typed the correct password.

Paul White
95.4k30 gold badges440 silver badges689 bronze badges
asked Jul 10, 2015 at 9:12
3
  • 1
    Can you test login in the command line: mysql -u root -p then your password? Commented Jul 10, 2015 at 13:20
  • Always test with the command line tool before blaming mysqld or MySQL Workbench. Commented Jul 10, 2015 at 15:29
  • Also, does ping work? Commented Jul 10, 2015 at 15:58

6 Answers 6

1

Since you get an "access denied" the actual connection to the server worked. You just have used a user that is not allowed to connect either because it connects from a machine that is not enabled in the user settings and/or the user does not exist or the password is wrong.

  • Is it the correct server you connected to?
  • Are you 100% sure to have used the right user/pw?
  • Is the IP address of the user allowed to connect at all?
joanolo
13.7k8 gold badges39 silver badges67 bronze badges
answered Jul 12, 2015 at 8:49
1

Access Denied while connecting to the database happens only when you are using wrong password. Quick check here -> MySQL installer will not provide an option for My SQL server installation if you have configured you MySQL server before on your system for eg. with phpadmin , though it will ask you to create a password for the server. This password hold false while logging into MySQL workbench. It will not override the password used before. Hence try using the old password rather than newly created password.

answered May 14, 2019 at 1:57
0

Check for root user in mysql first. Set the password during first login and check if port and ip is added in /etc/my.cnf file. Hash the bind address and try again.

answered Jul 11, 2015 at 20:23
0

As mentioned in comment

  1. Try to ping the server
  2. If you have another MySQL client/server try this:

    mysql -h XXX.XXX.X.XX(your IP) -u root -p

  3. Check privileges for root user; you can always do this

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpass' WITH GRANT OPTION;

    FLUSH PRIVILEGES;

  4. If you are using firewall, check iptables

These are possible solutions which solve my problem most of the time.

mustaccio
28.7k24 gold badges60 silver badges77 bronze badges
answered Jul 1, 2016 at 13:34
0

If you are getting this error in Workbench then follow this steps.

First simply log in with your current password:

sudo mysql -u root -p

Then change your password because having low strength password gives error sometimes.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-strong-password';
FLUSH PRIVILEGES;

Then simply exit and again login with your new password:

quit
sudo mysql -u root -p

Once you successfully logged in type the command:

use mysql;

It should show a message like 'Database changed' then type:

UPDATE user SET plugin='mysql_native_password' WHERE User='root';

After that type:

UPDATE mysql.user set authentication_string=PASSWORD('new-strong-password') where user='root';

Then type:

FLUSH PRIVILEGES;

Then simply exit:

quit

Now try to log in with your new password in your WORKBENCH. Hope it will work. Thank you.

answered Apr 17, 2020 at 17:00
0

I had the same problem with MySQL version 8.0.23.

I solved it in the following way:

  1. Opening again the msi installer for windows.

  2. In MySQL Server I clicked on "Reconfigure".

  3. Then I clicked on the following steps until I got to "Accounts and Roles" and there I set the password for "root".

  4. Finally in SQL Workbench, I went to Manage Server Connections and clicked on "store in Vault..." where I entered the same password as in step 3.

PS: This procedure also creates the MySQL Service on windows which also helps to solve this problem.

I hope this is helpful

answered Apr 12, 2021 at 2:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.