Solutions for MySQL database death and DoS

Source: Internet
Author: User

From Mysql 5. after a version of x, the feature of MySQL to automatically close idle connections has been modified. For example, if a connection is idle to a timeout time (the default value is 28000 seconds and 8 hours ), re-initiated Reconnect reconnection requests will not be accepted, and new connections need to be re-established, which causes the re-Connection Mechanism of SER to fail: the SER only uses the same connection interface when it needs to operate the database. If it is disconnected, it initiates a reconnection request. In addition, this problem cannot be solved by the SER in a short period of time.

The solution is described as follows:

1. Use Mysql 4.0 or 4.1 if some new features such as stored procedure triggers of Mysql 5 are not used.

2. regularly restart the Mysql server or Ser (because this problem may also affect other server programs that require Mysql support, it is better to restart the Mysql server, however, it is difficult to determine the time when the Mysql server is not used for restart)

3. Set my. cnf and add parameters in the mysqld field:

[Mysqld] port = 3306 socket =/tmp/mysql. sockwait_timeout = 500000interactive_timeout = 500000 (timeout of about five or six days in 500000 seconds, you can select a time value that may be idle for a database as needed .) Restart the Mysqld application. You can also add the-o wait_timeout = 500000 parameter when executing mysqld.

When you show variable on the MySQL client, you can see that the last line is changed from the default wait_time = 28000 to 500000.

(If the Mysqld restart does not take effect, restart the host)

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.