mysql workbench can't connect to database but connection test is ok

Viewed 17426

I have a mysql server with user 'root' and no password.
When I do mysql -u root -p in a terminal I can connect to my server.
When I use mysql workbench, if I test this connection, it s successful.
But when I try to connect to the server with mysql workbench I am getting this error :

Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306: Could not open database

Please: 1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from

Does anybody know what's going wrong here?

[UPDATE]
I am still having this problem.
With mysql workbench : test connection is ok, but I cannot connect to mysql server.
If this can help, here is mysql server status :
mysql Ver 14.14 Distrib 5.6.28, for debian-linux-gnu (x86_64) using EditLine wrapper

Connection id:      7
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     5.6.28-0ubuntu0.15.10.1 (Ubuntu)
Protocol version:   10
Connection:     localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:       3306
Uptime:         50 sec

Threads: 3  Questions: 69  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 1.380

Thanks for your help.

8 Answers

Perhaps you set something in the:

[Preferences -> Modeling -> MySQL -> Default Target MySQL Version]

Clear it and try again.

I have faced the very same issue

at my local instance I have started originally the mysql-workbench with sudo and because of that some directories and files were assigned to root in the ~/.mysql/workbench/ folder, so I have deleted the full directory(~/.mysql/workbench/) and all was OK at the next run

I had the same issue, the way I solved it was to run the workbench as root command with

 sudo mysql-workbench

I was facing the same error. I could connect using terminal but not using workbench.

In addition, I could not connect localhost with

sudo mysql-workbench

as well.

So, I follow these steps and it worked for me: https://phoenixnap.com/kb/access-denied-for-user-root-localhost

I run this command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'insert_password';

and then it was possible to access without admin privileges using the password 'insert_password' in the workbench.

Related