【发布时间】:2016-03-12 02:30:48
【问题描述】:
我正在尝试从 Windows 10 连接到 Ubunutu 14.04。我正在使用 ssh。 该连接似乎可以登录到机器,但它没有连接到数据库。我知道我使用了正确的密码。 错误信息是:
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
我要连接的用户是这样创建的:
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@'%'
我可以像这样从远程 ubuntu 机器连接;
mysql --user=fred --host=xx.xx.xx.xx --port=3306 -p
/var/log/mysql 中没有提到连接
/var/log/auth 显示
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)
ssh 连接到 root,但我用非 root 用户尝试过,没有任何区别。
这些是连接选项卡中的详细信息:
SSH Hostname: xx.xx.xx.xx
SSH Username root
SSH KeyFile: [dir]\.ssh\id_rsa
MySQL Hostname:localhost
MySQL Server Port: 3306
username: xxxx
【问题讨论】:
-
您能告诉我们您是如何在 ssh 中配置隧道的吗?您应该仔细检查您是否设置了从本地端口 3306 到远程端口 3306 的隧道。
-
除了 MySQL Workbench 连接页面中的详细信息之外,我没有设置任何其他内容。我认为它负责设置隧道。肯定似乎正在与服务器建立连接。之后发生的事情似乎是问题所在。我已编辑问题以包含我在连接页面中的详细信息
标签: mysql ssh mysql-workbench