python - _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10055)") -


i'm getting following error when running python script on 2008 vm running mysql server 5.6 using ajax

traceback (most recent call last):   file "mypythonjob.py", line 22, in <module>     db = mdb.connect('localhost', 'website','servername', 'website')   file "c:\python27\lib\site-packages\mysqldb\__init__.py", line 81, in connect     return connection(*args, **kwargs)   file "c:\python27\lib\site-packages\mysqldb\connections.py", line 187, in __init__     super(connection, self).__init__(*args, **kwargs2) _mysql_exceptions.operationalerror: (2003, "can't connect mysql server on 'localhost' (10055)") 

i can watch in resource monitor cpu climbs 100% after 75 seconds @ point mysql.exe has 30 threads , python.exe has 6 threads error kicks out , python.exe terminated , mysql server un reachable 2mins comes on line.

import os, datetime, pymssql , time, subprocess import mysqldb mdb today = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) sixmonth = today - datetime.timedelta(days=180) db = mdb.connect('localhost', 'website','server', 'website')  #values changed post cursor = db.cursor() sql2 = "select 1column mytable 4column '"+str(today)+"'"   #values changed post (query produces 1100 rows) cursor.execute(sql2) data2 = cursor.fetchall() cursor.close() db.close()   row2 in data2:     db = pymssql.connect(host="sqldb",user="username", password="pwd", database="somedatabase")  #values changed post     cursor = db.cursor()     sql3 = "set transaction isolation level read uncommitted; select col1,col2,col3 tbl col1 '%somedata%' , col3 < '"+str(sixmonth)+"' , col2 ='data'"     #values changed post     cursor.execute(sql3)     data3 = cursor.fetchall()     db.commit()     cursor.close()     db.close()     row3 in data3:         db = mdb.connect('localhost', 'website','server', 'website')         cursor = db.cursor()         sql4 = "update mytable set 2column ='"+str(row3[2])+"', 3column ='"+str(row3[1])+"' 4column '"+str(today)+"' , 1column '"+str(row3[0])+"'"      #values changed post (seems finish update @ 575 rows)         cursor.execute(sql4)         data4 = cursor.fetchall()         db.commit()         cursor.close()         db.close() 

resolution attempts ran code small 10 row of starting data vs 1100 checked make sure i'm closing connections , db's when i'm done them check mysql log file there nothing changed setting max_allowed_packet in my.ini 32mg 500mg , commented out

thanks looking

added note: if remove set transaction isolation level read uncommitted; second query seems continue run. let go 5 mins , count stopped @ 575 updated , held there.

solved issue, not passing variable first query second killing server results passing bloating line count update.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -