Django | OperationalError: MySQL connection is unavailable, disappears when the page reloads, what is wrong?

I sometimes get the following error in Django that disappears when the page reloads, I don’t know how to reproduce it. I tried to set wait_timeout to 12 hours in my.cnf, but the error appeared again on mysqld restart, although it was not when I restarted mysqld again, very strange to me.

Traceback (most recent call last):
File ".../python3.4/site-packages/django/db/backends/__init__.py", line 131, in _cursor
return self.create_cursor()
File ".../python3.4/site-packages/mysql/connector/django/base.py", line 536, in    create_cursor
cursor = self.connection.cursor()
File ".../python3.4/site-packages/mysql/connector/connection.py", line 1231, in cursor
raise errors.OperationalError("MySQL Connection not available.")
mysql.connector.errors.OperationalError: MySQL Connection not available.
+4
source share
1 answer

django 1.6? , 12 ? , . CONN_MAX_AGE = 3600 django. , wait_timeout mysql, - .

https://docs.djangoproject.com/en/1.6/ref/settings/#conn-max-age

+2

Source: https://habr.com/ru/post/1533370/


All Articles