我有一个 mysql 服务器,用户为“root”,没有密码。
当我在终端中执行 mysql -u root -p 时,我可以连接到我的服务器。
当我使用mysql workbench时,如果我测试这个连接,它是成功的。
但是当我尝试使用 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 服务器状态:
mysql Ver 14.14 Distrib 5.6.28,用于使用 EditLine 包装器的 debian-linux-gnu (x86_64)
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 中的某种缺陷或错误。
关于mysql workbench无法连接到数据库,但连接测试正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35913946/