Solve the mysql server has gone away problem through wait_timeout

Source: Internet
Author: User

Open the my. ini configuration file in the mysql database and find

Wait_timeout: the wait_timeout parameter is 5.

Wait_timeout = 5

This means that the connection will be automatically disconnected in 5 seconds, and the data submitted will come out of mysql server has gone away. Let's take a look at the solution.

Wait_timeout -- the number of seconds that mysql will wait before closing a non-interactive connection

Wait_timeout:

(1) if the size is set, the connection is closed quickly, so that some persistent connections do not work.


At that time, I set it

Wait_timeout = 300 is 300 seconds, so we can test again and find that there is no problem,

Supplement

Interactive_time -- refers to the number of seconds that mysql will wait before closing an interactive connection (for example, a connection in mysql gui tool)

(2) if the value is too large, it may take too long to open the connection. During show processlist, too many sleep connections can be seen, resulting in a too worker connections error.
(3) wait_timeout is generally expected to be as low as possible
 
The setting of interactive_timeout will have little impact on your web application.

Finally, some people on the Internet say this setting

Add or modify the following two variables in the my. cnf file:
Wait_timeout = 2880000
Interactive_timeout = 2880000

In this way, it is not responsible for how long it takes to configure wait_timeout = 2880000. It is a waste of performance, so you can set a proper one.

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.