mysql workbench无法连接到数据库,但连接测试正常

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

我有一个带有用户" root"且没有密码的mysql服务器。
当我在终端中执行mysql -u root -p时,我可以连接到服务器。
当我使用mysql工作台时,如果测试此连接,则说明连接成功。
但是,当我尝试使用mysql workbench连接到服务器时,出现此错误:

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

有人知道这是怎么回事吗?

[更新]
我仍然有这个问题。
使用mysql workbench:测试连接正常,但是我无法连接到mysql服务器。
如果这可以帮助,这是mysql服务器状态:
适用于使用EditLine包装程序的debian-linux-gnu(x86_64)的mysql Ver 14.14 Distrib 5.6.28

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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

谢谢你的帮助。


我自己也遇到了这个完全相同的问题。

我可以通过以管理员身份运行Mysql Workbench来克服它。 (关闭所有正在运行的实例。从开始菜单中右键单击它,然后选择"以管理员身份运行"。)

如果我不以提升的特权运行它,它将无法连接。因此,这一定是Workbench中的某种缺陷或错误。


关于此错误报告的最后评论对我有用...

[7 Jul 2016 18:33] Gaurav Vasistha

Solved for windows 7 64 bit mysql workbench 6.0 CE solution is weird
but it works so just give it a try

  • Go to Start.
  • Type %temp% in the search box and then click the Temp folder item that appears at the top.
  • At the top of the Explorer window, in the address bar, click the folder to the left of Temp in the folder path (Local by default).
  • In the folder list, right-click the Temp folder and then click Properties and then click the Security tab.
  • Click the Edit button and on the next screen click Add.
  • On the next screen, in the large text window type Everyone and then click Check Names - Everyone should then be underlined.
  • Check the box for Full control under the Allow column, and then click OK, then OK again, and OK again to close all the windows.
  • I discovered this while trying to uninstall workbench in order to
    reinstall it and while installing it gave an error message "the
    installer has encountered an unexpected error installing this package
    2203 windows 7"


    我遇到了同样的问题

    在我的本地实例中,我最初使用sudo启动了mysql-workbench,因为某些目录和文件被分配给?/ .mysql / workbench /文件夹中的root,所以我删除了完整目录(?/ .mysql / workbench /),下次运行一切正常


    也许您在以下位置设置了一些内容:

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

    清除它,然后重试。


    终端客户端会执行自动回退,而MySQL Workbench不会。如果通过TCP / IP的连接失败,则终端客户端将尝试通过套接字进行连接。如果服务器配置为使用套接字,则必须在MySQL Workbench中也使用此方法。