无法使用MySQLWorkbench连接到(远程)MySQL数据库

时间:2016-07-23 21:53:27

标签: mysql mysql-workbench

我正在使用带macOS 10.11.6的Mac。我想将MySQLWorkbench 6.3.7连接到存储在我的Linux服务器上的MySQL数据库。我能够与Sequel Pro建立连接,但它在MySQLWorkbench中无法正常工作。这就是我在做的事情:

1. Open "Setup New Connection" window
2. Selecting "Standard TCP/IP over SSH"
3. SSH Hostname = my servers IP
4. SSH Username = same I use to login in MySQL database with PHPMyAdmin
5. SSH Password = same I use to login in MySQL database with PHPMyAdmin
6. SSH Key File = I do nothing here, stays empty
7. MySQL Hostname = my servers IP
8. MySQL Server Port = I do nothing here, stays empty
9. Username = same I use to login in MySQL database with PHPMyAdmin
10. Password = this is the password I also use to access my server with the FTP client
11. Default Schema = I do nothing here, stays empty

点击“测试连接”时,我得到:

Please enter password for the following service:
Service: Mysql@MY_IP:3306@MY_IP
User: MY_USERNAME

当我输入密码时,我得到:

Failed to Connect to MySQL at MY_IP:3306 through SSH tunnel at MY_USERNAME@MY_IP with user MY_USERNAME
Can't connect to MySQL server on '127.0.0.1' (61)

我做错了什么?请有人帮帮我吗?

P.S。我用MY_IP和MY_USERNAME替换了IP和用户名。

1 个答案:

答案 0 :(得分:0)

首先,确保您的远程服务器已启用ssh。

其次,假设它确实启用了SSH,通常 SSH用户名和MySQL用户名将不同(出于安全原因)。无论如何,请确保您拥有正确的SSH用户名/密码(听起来您已经拥有正确的MySQL用户名/密码)。

第三

4. SSH Username = same I use to login in MySQL database with PHPMyAdmin
   - See above
5. SSH Password = same I use to login in MySQL database with PHPMyAdmin
   - See above
7. MySQL Hostname = my servers IP
   - Usually the value for this is either localhost or 127.0.0.1 - try either of
     those and see what happens.

在个人方面,我尝试升级我的MySQL Workbench版本(使用OSX),我只有问题,所以我不得不下载以前的版本。似乎对我有用的唯一一个是here。如果我上面提出的建议都不适合你,也许可以尝试删除当前版本并下载早期版本,看看是否是导致问题的原因。