mysqlclient
Python interface to MySQL
Decision gist · record as of 2026-08-14
Yes, if you need native MySQL/MariaDB connectivity and accept the GPL-2.0-or-later license terms. The package is production-stable, actively maintained, and widely used. Install friction is moderate but manageable: Windows users have pre-built wheels; Linux/macOS users must pre-install system libraries. Not suitable if your project cannot comply with GPLv2 copyleft obligations.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires MySQL or MariaDB client libraries installed on the system; on Linux/macOS, development headers must be present before pip install.
- Windows users need Python 3.10–3.14 for pre-built wheels, or the MariaDB C Connector for source builds.
- Medium install friction: requires MySQL or MariaDB development headers and libraries on Linux/macOS; Windows users benefit from pre-built wheels for Python 3.10–3.14.
License · maintenance · safety
GPL-2.0-or-later (copyleft) — Licensed under GPL-2.0-or-later (copyleft): any application linking mysqlclient must comply with GPLv2 terms, including potential source code disclosure obligations. Verify compatibility with your project's license before use.
last release 2026-02-10 (185 days) · last repo commit 2026-07-26 · 2,532 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 21,563,983 downloads/mo, #998 on PyPI
Alternatives
Verify before relying
pip install mysqlclient
import mysqlclient
conn = mysqlclient.connect(host='localhost', user='user', passwd='password', db='database')
cursor = conn.cursor()
cursor.execute('SELECT * FROM table')
results = cursor.fetchall()
conn.close()- Whether free threading support (experimental in v2.2.8) is production-ready for your workload.
- Performance characteristics compared to alternative MySQL drivers in your specific use case.
- Full scope of GPLv2 compliance requirements for your application's distribution model.
What it is and what it does
mysqlclient is a Python database driver for MySQL and MariaDB, forked from MySQLdb1 and extended with Python 3 support and bug fixes. It provides a low-level interface to execute SQL queries, fetch results, and manage database connections directly from Python. The package is a C extension that wraps the MySQL client library, making it a native choice for applications that need direct MySQL access.
The package requires system-level MySQL or MariaDB development libraries to build and install. On Windows, pre-built wheels are available for Python 3.10 through 3.14, simplifying installation. On Linux and macOS, you must install development headers before pip install. The project is actively maintained, supports Python 3.10 and later, and includes experimental free-threading support as of v2.2.8, though single Connection objects remain unsafe for concurrent multi-threaded access.
Use it for
- Building web applications that require direct MySQL database connectivity and query execution independent of higher-level ORMs.
- Writing data migration or ETL scripts that need to read from and write to MySQL/MariaDB databases with fine-grained control.
- Creating command-line tools or batch jobs that execute complex SQL queries and process result sets from MySQL.
- Integrating legacy MySQL databases into modern Python applications where a lightweight, native driver is preferred.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need native MySQL/MariaDB connectivity and accept the GPL-2.0-or-later license terms.
The package is production-stable, actively maintained, and widely used. Install friction is moderate but manageable: Windows users have pre-built wheels; Linux/macOS users must pre-install system libraries. Not suitable if your project cannot comply with GPLv2 copyleft obligations.
Install
mysqlclient on PyPI
Before you install
Medium install friction: requires MySQL or MariaDB development headers and libraries on Linux/macOS; Windows users benefit from pre-built wheels for Python 3.10–3.14. The project is actively maintained with a recent release and clear documentation on platform-specific setup.
Requires MySQL or MariaDB client libraries installed on the system; on Linux/macOS, development headers must be present before pip install. Windows users need Python 3.10–3.14 for pre-built wheels, or the MariaDB C Connector for source builds.
License in practice
Licensed under GPL-2.0-or-later (copyleft): any application linking mysqlclient must comply with GPLv2 terms, including potential source code disclosure obligations. Verify compatibility with your project's license before use.
Quickstart
pip install mysqlclient
import mysqlclient
conn = mysqlclient.connect(host='localhost', user='user', passwd='password', db='database')
cursor = conn.cursor()
cursor.execute('SELECT * FROM table')
results = cursor.fetchall()
conn.close()
Verify before relying
- Whether free threading support (experimental in v2.2.8) is production-ready for your workload.
- Performance characteristics compared to alternative MySQL drivers in your specific use case.
- Full scope of GPLv2 compliance requirements for your application's distribution model.
Package facts
| License | GPL-2.0-or-later copyleft |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 185 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 21,563,983 / month, #998 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Other EnvironmentOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: Windows :: Windows NT/2000Operating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: DatabaseTopic :: Database :: Database Engines/Servers |
Evidence: mysqlclient-2.2.8-cp310-cp310-win_amd64.whl; mysqlclient-2.2.8-cp311-cp311-win_amd64.whl; mysqlclient-2.2.8-cp312-cp312-win_amd64.whl; mysqlclient-2.2.8-cp313-cp313-win_amd64.whl; mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl; mysqlclient-2.2.8-cp314-cp314-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python mysql interface”
- mysqlclientmysqlclient provides a Python interface to MySQL and MariaDB…
- MySQL-pythonMySQL-python provides a Python 2 interface to MySQL databases,…
- mysql-connectorMySQL driver written in Python that enables database connections and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also mariadb · mysql · PyMySQL · MySQL-python · django-mysql · types-mysqlclient · asyncmy · mysql-connector-python · mycli · mysql-connector