mysqldb issue

fedor f.baart at gmail.com
Thu Mar 10 14:07:44 CET 2005


Hi all,
 
 I have a problem with mysql connections. After about 28000-29000 
 connections, I get a "Can't connect to MySQL server on '127.0.0.1'" error.
 
 I have made a small program which generates the error
 
"""
 import MySQLdb
 
 for i in range(30000):
     if not i % 100:
         print i
     db = MySQLdb.connect(host='127.0.0.1', user='me',passwd='mypassword')
     c = db.cursor()
     c.close()
     db.close()
""" 
 This is the error after making about 28200 connections:
 '''
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/tmp/python-12448vuu", line 7, in ?
     db = MySQLdb.connect(host='127.0.0.1', user='me', passwd='mypassword')
   File "/usr/local/lib/python2.3/site-packages/MySQLdb/__init__.py", line 
 64, in Connect
     return apply(Connection, args, kwargs)
   File "/usr/local/lib/python2.3/site-packages/MySQLdb/connections.py", 
line 
 116, in __init__
     self._make_connection(args, kwargs2)
   File "/usr/local/lib/python2.3/site-packages/MySQLdb/connections.py", 
line 
 41, in _make_connection
     apply(super(ConnectionBase, self).__init__, args, kwargs)
 _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server 
on 
 '127.0.0.1' (99)")
 '''
 
 Does anybody know how to solve this issue?
 
 
 System: Suse 8.1, mysql 4.0.14, mysqldb 1.0.1, python2.3 
 
 
 Thanks very much.....
 
 Fedor




More information about the Python-list mailing list