java – Mysql connection taking a long time


There are three machines that are on the same network. Mysql is running on one, the other two act as a client. At the same time, on one client machine, the connection is established in a fraction of a second, on the second it takes a long time to connect quickly. Checked with the command: telnet database.server 3306

The difference between the two client machines is that one is running Ubuntu 14.04 and the other is running Ubuntu 16.04

The question is where to dig?


Most likely the problem is that MySQL does a DNS lookup for each client, add the following line (skip-name-resolve) to the configuration (my.cnf) in the mysqld section and restart the server


To determine the causes of such problems, study and use the tcpdump command, it will tell you at what stage the connection problem occurred.

Scroll to Top