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?

link|improve this question

60% accept rate
feedback

1 Answer

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.

link|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
2  
@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
3  
@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
feedback

Your Answer

 
or
required, but never shown

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