Backport of fc8a6a9b00 from master
fc8a6a9b00
Thanks Corey Farwell for the report and Tim Graham for the review. Thanks also to Inada Naoki for creating and maintaining mysqlclient.