Forums

mysql.connector.errors.DatabaseError: 4031 (HY000)

Approximately every 5 - 15 minutes after launch, if I turn to the telegram bot, I get an error

python File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 540, in cmd_query raise errors.get_mysql_exception(exc.errno, msg=exc.msg, mysql.connector.errors.DatabaseError: 4031 (HY000): The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.

Is this normal on a free account, or is the problem in my telegram bot code?

It is normal for all accounts. See https://help.pythonanywhere.com/pages/ManagingDatabaseConnections/

Please explain this error. it Pop up when i use website long then server getting crashed.

Your problem is the same as the "Dealing with OperationalError 2006, 'MySQL server has gone away'" section in the page that glenn shared. Follow the "handle errors manually" section to fix it

Your problem is the same as the "Dealing with OperationalError 2006, 'MySQL server has gone away'" section in the page that glenn shared. Follow the "handle errors manually" section to fix it