Jump to content

Occasional Unknown server host; mysqli_connect() [function.mysqli-connect]: (HY000/2005)


floridaflatlander

Recommended Posts

Most of the time my localhost works like a champ but occasionally I  get  ... mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'localhost' (11001)

On phpfreaks I've searched for "Unknown MySQL server host localhost " and didn't see an answer to this problem

Then I googled and found this http://stackoverflow.com/questions/16580370/mysql-error-2005-unknown-mysql-server-host-localhost11001

However in this file the localhost ip is commented out and windows wont let me edit the file to uncomment it like it's done in the stackflow post.

 

So, one is this the likely problem ... and if it is how do I edit a file in the Windows folder?

 

As a note I do go into the file as the administrator using notepad

 

Thanks

Don't know your Windows version, but something like this should do the trick.

Run a "Command Prompt" as Administrator.  (If you can find a shortcut to the Command Prompt, RIGHT-click and choose "Run as Administrator").

The Administrator Command Prompt should put you in the system32 directory, and the prompt should look like this:
 

c:\windows\system32>

At the prompt, type "notepad drivers/etc/hosts", and add the line noted in the S.O. post to your HOSTS file.  Save the file, and then try the command "ping localhost" at the prompt.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.