I'm connecting to 2 databases via mysql.connect
oldCnx = mysql.connector.connect(user='root', password='root', host='127.0.0.1', database='testdb', connect_timeout=10000)
Connection to remote db set in the same way (just with other credentials). After a 20 (or 60) minutes I get error:mysql.connector.errors.OperationalError: 2055: Lost connection to MySQL server at '127.0.0.1:3306', system error: 10054. An existing connection was forcibly closed by the remote host
.
What to do? Do I need to expand timeout somehow or reconnect when connection is forcibly closed? If so, how would I do it?