Sunday, September 12, 2010

MySQLdb - 1153, 'Got a packet bigger than 'max_allowed_packet' bytes'

the technology

- mySQL Server 5.?
- python 2.6
- MySQLdb 2.3.1?
- Windows 7

the scenario

1. import MySQLdb
2. create a connection to the db:
> connxn = MySQLdb.connect(params_dict)
3. loop, re-using the connection, each time inserting say 250 records in one query
> cursor = connxn.cursor()
> cursor.execute(multi_record_insert_statement)
> cursor.close()
> connxn.commit()

problem is, i was getting the following errors:

- 1153, 'Got a packet bigger than 'max_allowed_packet' bytes'
then, when i tried to create a new connection, i was getting
- 2006, 'MySQL server has gone away'

1 comment:

comment: