MySQL中的睡眠过程 [英] Sleeping Processes in MySQL
问题描述
我有一系列旨在长期运行的python脚本.当我查看MySQL进程监视器时,我看到它们中的三个始终为0,那么,我用于将数据实际插入数据库中的其中两个将始终保持递增计数,并且永远不会重置设为0,表示最终他们遇到了可怕的"MySQL已经消失".
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'.
我正在使用MySQLdb.
I am using MySQLdb.
有人可以解释为什么会这样吗?
Can someone please explain why this happens?
是否有办法确保将其重置为0?
Is there a way to make sure that they reset this value to 0?
谢谢
推荐答案
听起来您的空闲超时即将到期.不过,这是在mysqld服务器配置中设置的,对于MySQLdb来说并不是真正的问题.您需要调整等待超时系统变量,可以在服务器配置中,也可以在连接时使用SQL语句.
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.
这篇关于MySQL中的睡眠过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!