Jump to content

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


floridaflatlander
 Share

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

Edited by floridaflatlander
Link to comment
Share on other sites

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.

Edited by dalecosp
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.