mysql client connection attempt to mysql server very slow

August 2, 2008 by gregorgede · 1 Comment
Filed under: MySQL 

computer A with ip 192.168.10.5 has mysql client on it and computer B with ip 192.168.10.6 has the mysql server. mysql client on computer A try to connect to mysql server on computer B :
$ mysql -u username -p -h 192.168.5.6

it takes at least 5 seconds before mysql prompt show up on the screen after entering password. this can be a problem when computer A is hosting a web application which needs to read it’s database on compter B. page generation would take very long time even when a lot of bandwidth are available. the solution to this problem is very simple. open /etc/hosts file on computer B and add the ip of computer A like this :
192.168.10.5 192.168.10.5

save and exit. now the connection attemp should be faster and mysql prompt will show up on the screen in a second. this might be applied to other application too, like ssh for example.

Reblog this post [with Zemanta]

Comments

One Response to “mysql client connection attempt to mysql server very slow”
  1. El Grande Cohones Says:

    Thanks, great post. Solved my SQL connection problems.

    For SSH you can edit the sshd_conf file and add UseDNS No.

    ___

    EGC




Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!