MySQL Connection timeout issue

Source: Internet
Author: User

A few days ago, a script was used to view the events in the Redis queue without stopping. If any, take the event out and perform some database operations.

It was later found that the first event of the day would lead to the occurrence of data that could not be found.

Later, the problem was that MySQL disconnected the connection in the event that the connection was not active for a long time. When PHP has an event that is ready to fetch data from the database, it captures the MySQL disconnected error.

The solution has two:

  1. Modify the MySQL configuration file, my.cnf
[mysqld] interactive_timeout=  wait_timeout=

All two parameters must be set at one time.

Related reference: http://www.cnblogs.com/jiunadianshi/articles/2475475.html

2. In the script in the MySQL connection timeout period, to access the database, to avoid the MySQL server disconnected.

MySQL Connection timeout issue

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.