2013-10-01 62 views
0

我在Mac上使用MySqlWorkbench並使用SSH連接到多個遠程服務器。如何解決SSH連接失敗?

其中2個是本地的 - 一個在我的本地VM中,另一個在整個房間的服務器上。第三個是在世界各地搖擺的其他地方。

我可以愉快地打開工作臺並立即連接到我的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秒左右的時間實現我不會得到一個連接,則不必關閉應用程序,然後重新打開它。

有時應用程序崩潰,但並不常見。

有什麼建議我可以做些什麼來幫助確定問題並消除它?

Regards,

Richard。

+0

不是超時的解決方案,但爲了更方便的重新連接使用菜單 - >查詢 - >重新連接到服務器。 –

回答

0

如果我理解正確的情況下,那麼你已經有了問題,如果死亡是閒置了一段時間的連接。嘗試設置Keepalive選項以保持每隔幾秒生成一些數據包。這應該可以防止您的連接死亡。

如果你自己建立連接,添加-o TCPKeepAlive=yes到命令行。如果它的一些應用開始爲你的連接,然後設置:

Host * 
TCPKeepAlive yes 
~/.ssh/config

應該做的伎倆。

相關問題