Sleeping Processes in MySQL

[亡魂溺海] 提交于 2019-12-24 15:20:06

问题


I have a series of python scripts that are designed to be long running. When I look at the MySQL process monitor, I see that three of them will always have a time of 0, then 2 of them that I use to actually insert data into the database will have values that are always counting up, and never get reset to 0 meaning that eventually they encounter the dreaded 'MySQL has gone away'.

I am using MySQLdb.

Can someone please explain why this happens?

Is there a way to make sure that they reset this value to 0?

Thanks


回答1:


It sounds like your idle timeout is expiring. This is set in the mysqld server configuration, though, and is not really an issue with MySQLdb. You need to adjust the wait-timeout system variable, either in the server configuration, or with an SQL statement when you connect.



来源:https://stackoverflow.com/questions/12564828/sleeping-processes-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!