U kunt de verbinding controleren met de is_connected methode met deze bibliotheek python-mysql :
cnx = connector.connect(user="user",password="pass",host="host",database="database")
if (cnx.is_connected()):
print("Connected")
else:
print("Not connected")