"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Why Does My MySQL Connection Timeout After 60 Seconds, Even Though `wait_timeout` Is Set Higher?

Why Does My MySQL Connection Timeout After 60 Seconds, Even Though `wait_timeout` Is Set Higher?

Published on 2025-01-29
Browse:751

Why Does My MySQL Connection Timeout After 60 Seconds, Even Though `wait_timeout` Is Set Higher?

MySQL server is disconnected after 60 seconds

The background of the problem An error encountered an error during a good SQL query before, and the error was overtime after 60 seconds and a error was thrown. Although the query is very slow, it runs as part of the night mission, so this is not a problem in itself (so do not recommend that I optimize it). Questions details

I reproduce the error by running the error from PHP's running "Select Sleep (120); (see below). The statements will be successful (returned 0). I think it is likely to be a problem, not the problem of resource restrictions. 36-COMMUNITY

PHP 5.3

test code, output and Show variables

[test code, output and Show Variables results in the result. Omitted here]

pHP option mysql.connect_timeout_timeout is the root cause of this problem. A response, you can add it like this:

ini_Set ('mysql.connect_timeout', 300);

ini_Set ('default_socket_timeout', 300);

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3