pypi / pymysql
pymysql
What changed in pymysql 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
9 breaking2 security6 deprecations4 new APIs and options1 performance1 behavior and defaults6 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpymysql 129 changes
Breaking changes 9
Fractional seconds now require a decimal point.
Non-finite decimal query parameters, including NaN, sNaN, and ±Infinity, are rejected.
connect() now uses keyword-only arguments, so callers must pass arguments by keyword.
escape_dict was removed from the pymysql module but remains available in pymysql.converters.
escape_sequence was removed from the pymysql module but remains available in pymysql.converters.
escape_string was removed from the pymysql module but remains available in pymysql.converters.
MySQL 5.5 and MariaDB 5.5 are no longer officially supported, though they may still work.
The old_password authentication method is no longer supported.
Python 2.7 and 3.5 are no longer supported.
Security 2
When ssl_verify_identity is set, the server certificate is checked.
Escapes the procedure name in callproc.
Deprecations 6
The reconnect parameter of Connection.ping() is deprecated.
Connection.set_charset() is deprecated at runtime and emits a warning.
The db parameter is deprecated again.
The passwd parameter is deprecated again.
The db keyword argument is deprecated; use database instead.
The passwd keyword argument is deprecated; use password instead.
New APIs and options 4
Adds two password-change error codes to the error constants.
MySQL protocol exceptions expose SQLSTATE without changing exception formatting.
Connections now support the context manager API; __exit__ closes the connection.
MySQL Connector/Python compatible TLS options were added.
Performance 1
Optimizes packet reading and parsing.
Behavior and default changes 1
TLS options now implement PREFERRED and REQUIRED SSL mode behavior.
Fixes and other changes 6
Adds a missing return statement in caching_sha2_password.
Fixes handling of escaped percent signs in executemany postfixes.
Restores the ability to import this function for compatibility with aiomysql.
Fixes an issue in the PyMySQL authentication state machine.
Fixes escaping of negative timedelta values.
The executemany INSERT regex supports MySQL 8 row/column alias syntax.