V
V
Vova Putsyk2018-09-07 21:02:17
MySQL
Vova Putsyk, 2018-09-07 21:02:17

Why is mysql connection closed in django?

I have a Telegram bot in Python using Django, the bot is constantly running and after a few hours the connection to the mysql database drops. Knocks out -

(2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
As far as I understand, this is due to the fact that the connection to the database is opened and can be open for a long time, am I right? If so, how can I properly close the connection, or what is the best thing to do in this case?
I've tried closing the connection via connection.close() from the django.db library after each bot command, but that doesn't help.
PS The service with the database crashes completely and does not want to be restarted, only a reboot on the server helps

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question