A Python database connector for MySQL and MariaDB, forked from MySQLdb1 with Python 3 support and bug fixes.
mysqlclient is a Python database connector that enables Python applications to interact with MySQL and MariaDB databases. It is a fork of MySQLdb1, updated with Python 3 support and numerous bug fixes, providing a reliable interface for executing SQL queries and managing database operations.
Python developers building applications that require database connectivity to MySQL or MariaDB, particularly those needing a stable, maintained alternative to MySQLdb1.
Developers choose mysqlclient for its active maintenance, Python 3 compatibility, and performance improvements over the original MySQLdb1, along with extensive documentation and cross-platform installation options.
MySQL/MariaDB connector for Python
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
As a fork of MySQLdb1, it explicitly adds Python 3 support and fixes bugs, ensuring compatibility with modern Python versions.
Since version 2.2.8, importing the module does not acquire the GIL, potentially improving performance in multi-threaded contexts, though with noted limitations.
The README provides detailed steps for Windows, macOS, and Linux, including binary wheels and source builds with environment variable customization.
Documentation is hosted on Read the Docs, offering a reliable reference for developers using the library.
The README warns that building on Windows is very hard, and if binary wheels are unavailable, setting up the MariaDB C Connector can be challenging with limited support.
Despite free threading, simultaneous operations on a single connection from multiple threads are not supported, and the behavior is undefined, restricting true concurrency.
mysqlclient is synchronous only, lacking built-in asynchronous capabilities, which may not suit applications using Python's async/await features.