无法从MySQL Workbench进行远程连接

时间:2015-12-07 13:11:07

标签: mysql ssh mysql-workbench

我正在尝试从Windows 10连接到Ubunutu 14.04。我正在使用ssh。 连接似乎可以登录到计算机,但它不会连接到数据库。我知道我使用的是正确的密码。 错误消息是:

with open("tester2.txt") as termsdesk:
    for line in termsdesk:
        term = matcher(keyword_dictionary, line.split(" "))

日志显示:

Failed to connect to MYSQL at localhost:3306 through SSH tunnel at username@xx.xx.xx.xx with user xxxx 
Unable to establish SSL connection 

我正在连接的用户是这样创建的:

12:27:02 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one 
12:27:06 [INF][ SSH tunnel]: Opening SSH tunnel to xx.xx.xx.xx:22 
12:27:08 [INF][ SSH tunnel]: TunnelManager.wait_connection returned OK 
12:27:08 [INF][sshtunnel.py:set_keepalive:502]: SSH KeepAlive setting skipped. 
12:27:08 [INF][ SSH tunnel]: SSH tunnel connect executed OK

我可以从这样的远程ubuntu机器连接;

mysql> create database fred 
mysql> CREATE USER 'fred'@'localhost' IDENTIFIED BY 'xxxx'; 
mysql> CREATE USER 'fred'@'%' IDENTIFIED BY 'xxx'; 
mysql> grant all privileges on fred.* to 'fred'@'x'; 
mysql> grant all privileges on fred.* to 'fred@'%' 

在/ var / log / mysql

中没有提到连接

/ var / log / auth显示

mysql --user=fred --host=xx.xx.xx.xx --port=3306 -p

ssh连接是root用户,但是我已经尝试过非root用户,但没有区别。

以下是连接标签中的详细信息:

Dec  7 14:03:46 www.example.com sshd[14474]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Dec  7 14:03:47 www.example.com sshd[14474]: Accepted publickey for root from xx.xx.xx.xx port 53591 ssh2: RSA ...
Dec  7 14:03:47 www.example.com sshd[14474]: pam_unix(sshd:session): session opened for user root by (uid=0)

2 个答案:

答案 0 :(得分:3)

仔细查看错误消息。它说无法建立SSL连接。它没有说任何关于SSH的事情。所以我猜MySQL Workbench设置为连接使用SSL加密,服务器不支持。您可以在连接设置中更改它:

enter image description here

或者,您可以使用SSL向导(也可从此页面获得)为正确的SSL连接生成SSL证书。

好消息:从服务器5.7.9开始默认启用SSL,服务器和客户端软件自动设置SSL详细信息。 MySQL Workbench当然也适用于此。

答案 1 :(得分:0)

我认为您的问题是正确配置您的SSH服务器以使用密钥而不是密码。检查其配置文件/ etc / ssh / sshd_config&从无变为是负责TCP转发的参数,因此AllowTcpForwarding是。