Sometimes you find a condition where your database connection (MySQL) is time out because of your queries are spending too much time. This is a hint on how you increase your MySQL time out configuration.
First you query your default connection timeout.
SHOW VARIABLES LIKE 'connect_timeout';
As you can see below, i have approximately 10 seconds before my mysql connection time out.
Next is updated it to 60 seconds.
SET GLOBAL connect_timeout=60;
Simple isn’t it.