Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

I was using mysql 5.6.11,it usually turned down and show me this:

2005 - Unknown MySQL server host 'localhost'(11001).

Currently my resolution is to turn off the network,than it return to normal.I had searched a lot,but no answer is revalent to it.So,does anyone knows the reason?

like image 862
user2388626 Avatar asked May 16 '13 06:05

user2388626


People also ask

What is my MySQL hostname?

The MySQL hostname will always be 'localhost' in your configuration files. If you need to connect to your database from your home PC, use your primary domain name or the server name that can be found in your account signup email.

Can't connect to local MySQL server through socket TMP MySQL sock?

It means either the MySQL server is not installed/running, or the file mysql. sock doesn't exist in /var/lib/mysql/ .


1 Answers

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

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.

like image 197
GaneshP Avatar answered Sep 18 '22 12:09

GaneshP