MySQL Sleep connection Too many problem solving method _mysql

Source: Internet
Author: User
Tags mysql manual

Sometimes you run show processlist in MySQL, and you'll see that there are many of these processes in the database:

The reason for sleep is three, and the following is an explanation from the MySQL manual:

1. The client program did not invoke Mysql_close () before exiting. [Write program negligence, or database DB Class library does not automatically close each connection ... ]
2. The client sleep time does not issue any requests to the server within the Wait_timeout or interactive_timeout specified seconds. [Similar to a common connection, similar to an incomplete TCP IP protocol construct, the server always believes that the client is still present (it is possible that the client has been disconnected)]
3. The client program sends a request to the server before it ends and the result is not returned. [See: Three Handshake for TCP IP Protocol]

And the solution is simple.

Add in configuration file

Copy Code code as follows:

[Mysqld]

wait_timeout=10


Or
Copy Code code as follows:

mysql> set global wait_timeout=10;

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.