MySQL – Difference Between wait_timeout and connect_timeout

my.cnfMySQL

I have a my.cnf file. In it I see wait_timeout as well as connect_timeout. What's the difference between these 2?

Best Answer

Right from the MySQL Documentation

  • wait_timeout : The number of seconds the server waits for activity on a noninteractive connection before closing it.
  • connect_timeout : The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake

EXAMPLES

  • If wait_timeout is 1800 (30 Minutes), the DB Connection will close in 30 minutes if the connection is idle (indicated by Sleep in the command column of the processlist).
  • If connect_timeout is 10, then mysqld will reject you if you cannot login (authenticate) in 10 seconds.