Mysql: Communications link failure solution, failure

Source: Internet
Author: User

Mysql: Communications link failure solution, failure

Mysql: Communications link failure solves the problem of connecting to MySQL using Connector/J. After the program runs for a long time, the following error will be reported: Communications link failure, the last packet successfully received from the server was *** millisecond ago. the last packet successfully sent to the server was *** millisecond ago. The error will also prompt you to modify wait_timeout or use the autoReconnect attribute of ctor/J to avoid this error. The default "wait_timeout" of the MySQL server is 28800 seconds, that is, 8 hours. This means that if the idle time of a connection exceeds 8 hours, MySQL will automatically disconnect the connection, the connection pool considers the connection to be valid (because the connection is not verified). When the application applies to use the connection, the above error is reported. There are two solutions: one is to modify my. cnf:
Wait_timeout = 31536000 interactive_timeout = 31536000 change the expiration time to one year. Second, add the parameter & autoReconnect = true & failOverReadOnly = false to the connection URL.

Related Article

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.