Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unknown MySQL server host 'localhost' (11001)

Posted on 2013-06-13
4
Medium Priority
?
6,709 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:BurundiLapp
ID: 39244049
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
ID: 39244098
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 2000 total points
ID: 39244104
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
ID: 39244132
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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