mysql TIME_WAIT ; too many connections problem

后端 未结 3 2123
心在旅途
心在旅途 2021-02-06 16:47

When i was checking for mysql load time on site. i got result showing connections as TIME_WAIT. Even though i close connection on every page. Sometimes the site doesnt load say

3条回答
  •  天命终不由人
    2021-02-06 17:44

    As @Zimbabao suggested in the comment, debug your code for any potential errors that may halt the execution of closing the Mysql connection.

    If nothing works, check your my.cnf for a system variable called wait_timeout. If its not present add it to the section [mysqld] and restart your Mysql server.

    [mysqld]
    wait_timeout = 3600
    

    Its the number of seconds the server waits for activity on a noninteractive connection before closing it. Further information can be found http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout

    Tune the figure 3600 (1 hour) to your requirements.

    HTH

提交回复
热议问题