mysql error 2005 - Unknown MySQL server host 'localhost'(11001)


有的時候偶爾會出現這個問題 2005 Unknown MySQL server host 'localhost' (11001),剛開始重啟電腦ok了,但是不能每次出現這個問題就重啟電腦吧,太麻煩了,總得找到原因。

ERROR 2005 (HY000): Unknown MySQL server host 'localhost' (0)

修改文件C:\Windows\System32\drivers\etc\hosts

添加127.0.0.1 localhost

在我的文件中這入口也是0.0.0.0 localhost:所以導致了這個問題,具體問什么會導致就不太清楚了

參考:http://stackoverflow.com/questions/16580370/mysql-error-2005-unknown-mysql-server-host-localhost11001

modify list of host names for your system:

C:\Windows\System32\drivers\etc\hosts

Make sure that you have the following entry:

127.0.0.1 localhost

In my case that entry was 0.0.0.0 localhost which caussed all problem

(you may need to change modify permission to modify this file)

This performs DNS resolution of host “localhost” to the IP address 127.0.0.1.

 

localhost是host文件中代表127.0.0.1的一個名稱, 如果在這個文件中去掉的話localhost就沒有實際意義

 

 

如果喜歡作者的文章,請關注"寫代碼的猿"訂閱號以便第一時間獲得最新內容。本文版權歸作者所有,歡迎轉載. 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM