Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 315
user1260928 Avatar asked Dec 03 '22 15:12

user1260928


2 Answers

I just ran into this exact same problem myself.

I can overcome it by running Mysql Workbench 'as administrator'. (close any running instances. right click it from the start menu, and choose 'run as administrator'.)

It just won't connect if I don't run it with elevated privileges. So it must be some kind of flaw or bug in Workbench.

like image 200
nl-x Avatar answered Dec 20 '22 20:12

nl-x


Perhaps you set something in the:

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

Clear it and try again.

like image 45
kim Avatar answered Dec 20 '22 21:12

kim