MySQL idle connection timeout error

Source: Internet
Author: User
The default ldquo of the MySQL server; wait_timeoutrdquo; is 8 hours (that is, the default value is 28800 seconds), that is, a connection is idle for more than 8 hours

The default ldquo of the MySQL server; wait_timeoutrdquo; is 8 hours (that is, the default value is 28800 seconds), that is, a connection is idle for more than 8 hours

The default "wait_timeout" of the MySQL server is 8 hours (that is, the default value is 28800 seconds). That is to say, if a connection is idle for more than 8 hours, MySQL will automatically disconnect the connection, in general, a connection is automatically disconnected if it is not active within 8 hours.

The following link will prompt an error: com. MySQL. jdbc. exceptions. MySQLNonTransientConnectionException: Connection. close () has already been called. Invalid operation in this state.

Check the MySQL5 manual and find that the maximum value of wait_timeout is 24 days/365 days (windows/linux ). Take windows as an example. If we want to set it to 21 days, we only need to modify the configuration file "my. ini "(MySQL5 installation dir), add a row in [MySQLd]: wait_timeout = 1814400

You need to restart MySQL 5.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.