我有以下内容:class FooData(object):
def __init__(self):
...
try:
self.my_cnf = os.environ['HOME'] + '/.my.cnf'
self.my_cxn = mysql.connector.connect(option_files=self.my_cnf)
self.cursor = self.my_cxn.cursor(dictionary=True)
except mysql.connector.Error as err:
if err.errno == 2003:
self.my_cnf = None
self.my_cxn = None
self.cursor = None
我可以使用my_cxn和{}而没有任何明显的失败。我从来没有明确地终止连接,并且在mysql错误日志中观察到以下消息。。。在
^{pr2}$
我是不是走错了路?每次需要运行查询时初始化连接器和游标是否更有效?在
我需要在mysql配置上查找什么来避免这些中止的连接?在
另外,我还经常在错误日志中看到这些消息:2017-01-06T15:28:45.203067Z 0 [Warning] Changed limits: max_open_files: 1024
(requested 5000)
2017-01-06T15:28:45.205191Z 0 [Warning] Changed limits: table_open_cache: 431
(requested 2000)
是否与上述情况有关?这意味着什么?我如何解决它?在
我尝试了涉及/lib/systemd/system的各种解决方案/云数据库服务.d/极限.conf和其他配置设置,但无法使其中任何设置工作。在