Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 VM's in the same machine, one running Apache, the other running MySQL.

When trying to connect from Apache to MySQL it takes 5 seconds for the console to come up.

When attempting to connect from Apache to an external MySQL, it works in less than 1/4 of a second.

How can I debug this? Could this be routing? I am accessing via IP, same network, same segment, etc.

How can I fix this?

share|improve this question

My money's on name resolution; the server's trying (and failing) to do a reverse DNS lookup on the private IP address that the connection's coming from.

Try the skip-name-resolve option.

share|improve this answer
Good suggestion... but it is already set... I also noticed the same latency with SSH access.. so it must be networking.. but not sure where... – smorhaim Dec 5 '11 at 21:09
@smorhaim SSH will exhibit the same issue with an IP that won't resolve to a name. Try adding an entry to the hosts file to circumvent and rule out name resolution issues. – Shane Madden Dec 5 '11 at 21:17
The solution was adding an entry in the target machine hosts file as suggested :) post it as an answer, so I can mark it as the winner. thanks. – smorhaim Dec 6 '11 at 1:25
@smorhaim: the correct answer is the answer. the hosts suggestion in the comment is a hack but not a solution. – Javier Dec 6 '11 at 4:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.