mysql-connector-python
A self-contained Python driver for communicating with MySQL servers, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249).
Decision gist · record as of 2026-08-14
Yes. This is the official MySQL driver for Python, actively maintained, with no runtime dependencies, and compliant with the standard database API. It supports current Python versions and carries no known vulnerabilities. The copyleft license requires attention if you are building proprietary software, but the FOSS exception typically permits use in open-source contexts. Install it when you need reliable MySQL connectivity from Python.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; MySQL server must be accessible at the specified host and port.
- Installation is straightforward via pip with no runtime dependencies.
- The package is actively maintained with a recent release and has been in production use since 2017.
License · maintenance · safety
copyleft license (copyleft) — Licensed under GNU GPLv2 with a FOSS License Exception, which permits use in open-source projects but may restrict proprietary software integration without careful review of the exception terms.
last release 2026-07-29 (16 days) · last repo commit 2026-07-29 · 958 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 49,550,032 downloads/mo, #581 on PyPI
Alternatives
Verify before relying
pip install mysql-connector-python
import mysql.connector
cnx = mysql.connector.connect(
host="127.0.0.1",
user="root",
password="password")
cur = cnx.cursor()
cur.execute("SELECT CURDATE()")
print(cur.fetchone())
cnx.close()- Whether the optional installation extras (dns-srv, gssapi, webauthn, telemetry) are documented with their specific dependency lists and compatibility constraints.
- Performance characteristics of the C-extension versus pure-Python implementation and when each is recommended.
- Support status and stability of the mysql.ai module for HeatWave GenAI and AutoML features relative to the core connector.
What it is and what it does
MySQL Connector/Python is the official Python driver for MySQL databases, implementing the PEP 249 database API specification. It provides synchronous and asynchronous connectivity to MySQL servers, with optional C-extension acceleration for performance-critical workloads. The package includes both the Classic and X DevAPI connector interfaces and supports modern Python versions (3.10 through 3.14).
Beyond basic database access, the connector offers optional integration with MySQL HeatWave's AI and machine learning capabilities through the mysql.ai module, which provides LangChain-compatible GenAI components and Scikit-Learn-compatible AutoML estimators. These advanced features require separate installation of langchain, pandas, and scikit-learn. The core connector has zero runtime dependencies and installs cleanly via pip.
Use it for
- Build Python web applications that need to query and update MySQL databases using standard PEP 249 cursor and connection interfaces.
- Integrate asynchronous database operations into async/await Python code for non-blocking I/O in high-concurrency scenarios.
- Connect Python data science workflows to MySQL HeatWave for AI-powered predictions and embeddings via LangChain or Scikit-Learn pipelines.
- Develop ETL pipelines that read from or write to MySQL using the connector's standard query execution and result-fetching APIs.
- Use the optional C-extension for performance-sensitive applications where pure-Python database access becomes a bottleneck.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is the official MySQL driver for Python, actively maintained, with no runtime dependencies, and compliant with the standard database API. It supports current Python versions and carries no known vulnerabilities. The copyleft license requires attention if you are building proprietary software, but the FOSS exception typically permits use in open-source contexts. Install it when you need reliable MySQL connectivity from Python.
Install
mysql-connector-python on PyPI
Before you install
Installation is straightforward via pip with no runtime dependencies. The package is actively maintained with a recent release and has been in production use since 2017.
Requires Python 3.10 or later; MySQL server must be accessible at the specified host and port.
License in practice
Licensed under GNU GPLv2 with a FOSS License Exception, which permits use in open-source projects but may restrict proprietary software integration without careful review of the exception terms.
Quickstart
pip install mysql-connector-python
import mysql.connector
cnx = mysql.connector.connect(
host="127.0.0.1",
user="root",
password="password")
cur = cnx.cursor()
cur.execute("SELECT CURDATE()")
print(cur.fetchone())
cnx.close()
Verify before relying
- Whether the optional installation extras (dns-srv, gssapi, webauthn, telemetry) are documented with their specific dependency lists and compatibility constraints.
- Performance characteristics of the C-extension versus pure-Python implementation and when each is recommended.
- Support status and stability of the mysql.ai module for HeatWave GenAI and AutoML features relative to the core connector.
Package facts
| License | copyleft license copyleft |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 16 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 49,550,032 / month, #581 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/StableIntended Audience :: DevelopersIntended Audience :: EducationLicense :: OSI Approved :: GNU General Public License (GPL)Operating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: DatabaseTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: mysql_connector_python-26.7.0-py2.py3-none-any.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 › “pep 249 mysql connector”
- mysql-connector-pythonMySQL Connector/Python is a PEP 249-compliant database driver that…
- mysql-connector-python-rfA pure-Python MySQL driver that implements the DB API v2.0…
- mariadbMariaDB Connector/Python provides a DB API 2.0-compliant interface…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also mysql-connector-python-rf · mariadb · MySQL-python · PyMySQL · mysql-connector · mysql · mysqlclient · hdbcli · cloud-sql-python-connector