如何解决SSH连接失败?

时间:2013-10-01 11:50:55

标签: mysql macos ssh mysql-workbench

我在Mac上使用MySqlWorkbench并使用SSH连接到多个远程服务器。

其中2个是本地的 - 一个在我的本地虚拟机中,另一个在服务器对面的房间内。第三个是全世界摆动的其他地方。

我可以愉快地打开工作台并立即连接到我的2台本地服务器。

我可以打开工作台,几个小时都不做任何事情,然后连接到它们,一切仍然有效。

我可以打开工作台并立即连接到远程服务器。一切都很好。

但是,如果我尝试连接到真正的远程服务器之后的任何延迟(比如一小时左右),我就会收到错误。

Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Tunnel error: Remote connection to 127.0.0.1:3306 failed: IOError('open SSH channel timeout',)

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

此时,我关闭应用程序,重新打开它,建立连接,一切都很好。

但是非常令人沮丧的是必须等待30秒才能意识到我不会得到连接,然后必须关闭应用程序然后重新打开它。

有时应用程序会崩溃,但不够频繁。

我可以采取哪些建议来帮助确定问题并消除它?

此致

理查德。

1 个答案:

答案 0 :(得分:0)

如果我正确理解了场景,那么如果连接暂停一段时间,你就会遇到连接死机的问题。尝试设置keepalive选项以保持每隔几秒生成一些数据包。这可以防止您的连接死亡。

如果您自己设置连接,请将-o TCPKeepAlive=yes添加到命令行。如果是某些应用程序为您启动连接,则设置:

Host *
TCPKeepAlive yes
<{1>}中的

应该可以解决问题。