python - 时不时出现 (2013, 'Lost connection to MySQL server during query')
PHP中文网
PHP中文网 2017-04-18 10:24:01
0
3
714

报错内容:

modles:

my.cn中
max_allowed_packet=1024M
skip-name-resolve

还是经常出现(2013, 'Lost connection to MySQL server during query')这个错误

请问哪里出问题了,应该怎么修改呢

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
PHPzhong

It is recommended that when asking questions, try to post the error message and the error code instead of taking screenshots.

The error message indicates that the mysql connection is lost.

search_cursor = search_conn.cursor()

Seeing that your list_related function did not pass in the search_conn parameter, did you define it as a global variable? If this is the case, it is because mysql has a default connect_timeout time, which will automatically close the connection once it is exceeded.

You can try the following two methods:

  1. Set the connect_timeout time when creating a connection and set it longer.

  2. Every time you operate the database, a connection is established and closed after the operation is completed.

黄舟

Judging from your SQL statement, it is not well written. You need to study it carefully and make full use of indexes or third-party word segmentation systems

Ty80

Django’s ORM is not easy to use?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!