5

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.

3
  • 1
    Can you test login in the command line: mysql -u root -p then your password?
    – oNare
    Jul 10, 2015 at 13:20
  • Always test with the command line tool before blaming mysqld or MySQL Workbench.
    – Vérace
    Jul 10, 2015 at 15:29
  • Also, does ping work?
    – Vérace
    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?
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.

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.

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.

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.