Recently when using the remote operation of java mysql database, the first request is very slow, and very easily lead to the collapse of the system connection timeout error
Here the problem is solved under the
-----------------------------------------------------------------
Most of our mysql configuration information of such (my modified, self mysql host information)
Where the configuration information, there are many online introduction, this side is not described in detail,
One of them (I do not have to configure) is extremely important
wait_timeout this property represents how long, mysql will not be disconnected, the default default is eight hours (28,800 seconds), if this value is set smaller, then it will lead to the first connection fails, or is easily disconnected!
If the remote server mysql appeared above problems can be solved with the following program (effective pro-test!):
the Variables, Ltd. Free Join Show like ' wait_timeout ' ; // query your current mysql default timeout is how much the SET , Ltd. Free Join wait_timeout = 604800 ; // set the timeout to 7 days
After setting looks like:
There is also a very important parameter is also prohibited DNS
The addition of such a field in mysqlid /etc/my.cnf of the following:
skip-name-resolve
Restart the database
DNS can also lead to slow ,, mysql web applications as well as reverse DNS problems can also cause slow, can mysql configuration file, use the above command to turn off the reverse DNS.
So far, the perfect solution!