Set MySQL Connection TimeOut

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. 😉

1 Comment


about 2 years ago

great article useful. keep it up


Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked