Can't connect to MySQL server on 'localhost'

今天測試SSH相關代碼,服務器啓動時控制檯報異常:mysql

Communications link failure,The last packet successfully received...

後來打開navicat,發現原來是數據庫打不開了,雙擊報錯誤 :sql

Can't connect to MySQL server on 'localhost' (10061);數據庫

網上查了不少,衆說紛紜,後來看到stackoverflow裏有一個解決方法簡單易行,試了下果真ok:windows

1.找到mysql安裝目錄,好比:C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin服務器

2.打開MySQLInstanceConfig.exe,從新設置相關參數,密碼哪怕設置的跟原來同樣都行。測試

完成後數據庫即能打開了。this

原文http://stackoverflow.com/questions/10892689/cant-connect-to-mysql-server-on-localhost-10061-after-installation spa

答案摘錄以下:orm

this issue is vary to solve by windows server usersserver

  1. go to this path C:\Program Files\MySQL\MySQL Server 5.1\bin

  2. run this tool "MySQLInstanceConfig.exe"

and config the instatnce again and problem solved.

固然,答主也提到了這一問題的解決方案因人而異。該答案未必適用每個報這種異常的問題,網上也有其餘多種解決方案。若是此路不通,可嘗試其餘方案。

相關文章
相關標籤/搜索