Saturday, 25 December 2021

Python MySQL-Connector failing to connect intermittently on Windows VPS

I am scraping data using a Windows VPS. I am using Python MySQL-Connector to upload this scraped data to a Linux dedicated server.

import mysql.connector

    mydb = mysql.connector.connect(
      host="...",
      user="...",
      password="...",
      database="...",
      connection_timeout=60
    )
    mycursor = mydb.cursor()

About 25% of the time this fails, or takes more than twenty seconds. When it fails I get a 10060 error. Is the problem more likely to be with my Linux server or more likely my Windows VPS? Help sincerely appreciated. Here is the error message:

2055: Lost connection to MySQL server at '[IP]:3306', system error: 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.


from Python MySQL-Connector failing to connect intermittently on Windows VPS

No comments:

Post a Comment