I executed the below code and it shows this error.
Here is the code snippet.
import pymysql
mydb = pymysql.connect(
database = "q11",
user = "111",
password = "11111",
host = "localhost"
)
The error I am getting is:
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionAbortedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None))")```
I have a problem when I connect to my MySQL database and after a long time, it hangs and my code is not getting anything from the database. I found a solution to my problem and put the DB connection in the main message handler