A mysql database connection is serialized by cloning the current object; removing the connection, schema and driverClasses to save space; serializing the result; and destroying the cloned stripped down object. When the object is destroyed mysql deconstructor will call nextIdDelete() to cleanup the sequences table but now that the object doesn't have a connection the attempt fails and results in an error.
There's already some special handling around this code for the testing case where the connection object is mocked. As a quick fix I've added in some additional code to check for the case where it's just not set at all but this doesn't seem like an ideal solution. Injecting a dummy connection object before destroying the mysql object might be better but I thought I'd see if anyone else had a better idea before writing that.