Solved

Unknown MySQL server host 'localhost' (11001)

Posted on 2013-06-13
4
5,602 Views
Last Modified: 2013-06-13
Hi, I have a mysql database application with a PHP font end.

Suddenly I am now getting the following error in my web browser when I access a page which includes a mysql connection:

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'localhost' (11001) in <path on local hard drive> on line 13
 Could not conneft to MySQL: Unknown MySQL server host 'localhost' (11001)

When I first access the application it all works fine but after about a dozen clicks (accessing of different pages/records) I locks up and I get the error.

When I try to connect the MySQL using the query browser I get the error:

Could not connect to the specified instance. MySQL Error Number 2005
Unknown MySQL server host 'locolhost' (110001)

When I ping localhost from the MySQL Query Browser I get "unable to resolve localhost" but I can still access the first web page in my browser which does not use a mysql connection so the localhost name is still resolved.

To add to this it will all suddenly start working again after about 5 -10 minutes. It's as if the connection cuts in and out!

Any help appreciated. Thank you.
0
Comment
Question by:EICT
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:BurundiLapp
Comment Utility
What platform is this running on, can you monitor the MySQL service to see if it is going offline after a few requests and then restarting itself?

Anything in the MySQL or the OS event logs to indicate an issue?  Are you logging PHP errors to a file, if so anything in there to indicate an issue?
0
 

Author Comment

by:EICT
Comment Utility
Hi BurundiLapp
I shall investigate more and get back to you.  Interestingly if I change localhost in the mysql_connection script to the IP address 127.0.0.1 it works. Change it back to localhost  and it stops again. It's as if mysql/php can't resolve localhost  because I can still ping it etc in a command prompt.  

I'm running Win 7.   I can't see any services stopping/starting. I tried restarting mysql & apache services in services.msc which did not appear to fix the problem.  Restarting my DNS-client services seems to be the fix. So it must be to do with DNS.
0
 
LVL 6

Accepted Solution

by:
BurundiLapp earned 500 total points
Comment Utility
It could also be related to IPV6 and DNS, I would also turn off IPV6 on that box if you are not using it.

Is there any reason you can't leave it configured as the IP to ensure there is no re-occurence?
0
 

Author Comment

by:EICT
Comment Utility
I logged DNS errors and was getting "A name not found error was returned for the name localhost. Check to ensure that the name is correct. The response was sent by the server at 213.120.234.6:53."   for some reason the BT DNS could not resolve it. Having said that I thought the PC resolved localhost itself.

You were spot on. I disabled IPv6 and it works now.   Strange why this suddenly started.

Thanks BurundiLapp
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now