1. 程式人生 > >【資料庫-MySql】Can’t connect to MySQL server on ‘xxxx’ (10061) 二

【資料庫-MySql】Can’t connect to MySQL server on ‘xxxx’ (10061) 二

一、問題描述

1、系統:

Windows Server 2000、Windows Server 2003、Windows Server 2008、Windows Server 2008 R2、Windows Vista、Windows Vista XP

2、描述:

使用連線工具頻繁連線,統計Mysq連線成功次數,Mysql有一定概率連線失敗。

MYSQL資料庫連線偶爾連不上,幾秒後又自動恢復

Can’t connect to MySQL server on ‘localhost’ (10061)

Can’t connect to MySQL server on ‘伺服器IP’ (10061)

二、微軟原文

當您嘗試從大於 5000 的 TCP 埠連線時收到錯誤 WSAENOBUFS (10055)

三、解決方法 - 針對Mysql所在伺服器

1、解除安裝KB967723補丁

2、修改登錄檔

reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "MaxUserPort" /t REG_DWORD /d "65534" /f 

reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TcpTimedWaitDelay" /t REG_DWORD /d "30" /f 

方式一、在執行執行

方式二、製作成bat檔案執行

方式三、直接在登錄檔新增

操作完成後請重啟Mysql服務!