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:
- 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