Ways to resolve MySQL database death and denial of service

Source: Internet
Author: User
Tags mysql client mysql database

After a version of MySQL 5.x, the feature of the automatic shutdown idle connection of MySQL is modified, if a connection is idle to timeout (default 28,000 seconds 8 hours), the Reconnect reconnection request is not accepted, and a new connection needs to be established. This leads to a ser mechanism that does not work: Ser only uses the same connection interface when it needs to operate the database, disconnects the request if it is disconnected, and the problem is not ser to be resolved in the short term.

  The following are specific ways to deal with:

1. Use MySQL 4.0 or 4.1, if you don't use some of the new features of MySQL 5, such as stored procedure triggers.

2. Timed reboot MySQL server or ser (because this problem may also affect some other need MySQL support server program, so restart MySQL server is good, but need to detect MySQL server is not used a time restart more difficult to determine)

3. Set MY.CNF, there are mysqld fields to add parameters:

[Mysqld]port = 3306socket =/tmp/mysql.sockwait_timeout= 500000interactive_timeout = 500000 (500,000 seconds timeout of approximately five or six days, Depending on your actual needs, you can choose a time value that is slightly larger than the maximum time that a database may be idle. Restart the mysqld application, or you can add the-o wait_timeout=500000 parameter to the same effect when the mysqld is executed.

In the MySQL client show variable should be able to see the last one from the default wait_time=28000 into 500000.

(If reboot mysqld does not take effect, can reboot machine)

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.