Repolode
mysql

mysql/mysql-connector-python

Pure-Python MySQL driver implementing the Client/Server protocol, with a DB API v2.0 Classic API and an X DevAPI for Document Store.

Stars
949
Forks
302
Open issues
6
Last commit
16 days ago

What is it?

MySQL Connector/Python is Oracle's official MySQL driver for Python. It implements the MySQL Client/Server protocol entirely in Python, so it needs no MySQL client libraries and no compilation to run. The Classic API follows the Python Database API Specification v2.0 (PEP 249), so code written against it looks like other Python DB drivers.

The same package also includes an implementation of the X DevAPI, used to work with the MySQL Document Store. It is installed separately as mysqlx-connector-python. Optional extras add telemetry, GSSAPI, WebAuthn, DNS SRV lookup, and compression support.

The package also ships an optional mysql.ai module for HeatWave GenAI and AutoML. It provides LangChain-compatible LLM, vector store, and embeddings classes, plus Scikit-Learn compatible estimators. These require langchain, pandas, and scikit-learn to be installed separately.

Key features

  • 01Implements the MySQL protocol in pure Python with no MySQL client library required.
  • 02Classic API complies with Python DB API v2.0 (PEP 249).
  • 03X DevAPI support for MySQL Document Store.
  • 04Optional C extension and asynchronous connectivity.
  • 05Optional telemetry via OpenTelemetry extras.
  • 06Installable via pip from wheel packages.

Use cases

  • Connecting a Python application or service to a MySQL database.
  • Working with MySQL Document Store collections through X DevAPI.
  • Building LLM or ML prototypes on data stored in HeatWave.

Quick start

  1. 1

    Install the Classic API connector with pip

    pip install mysql-connector-python
  2. 2

    Connect to a MySQL server and run a query using the sample code from the README

Things to know

  • The optional HeatWave GenAI and AutoML features require separately installed langchain, pandas and scikit-learn, and target MySQL HeatWave.
  • The license is listed as NOASSERTION in the metadata, so check LICENSE.txt before use.

In collections

Topics

#mysql#database-driver#python#sql#dbapi#document-store#heatwave

FAQ

What is mysql-connector-python?
Pure-Python MySQL driver implementing the Client/Server protocol, with a DB API v2.0 Classic API and an X DevAPI for Document Store. MySQL Connector/Python is Oracle's official MySQL driver for Python. It implements the MySQL Client/Server protocol entirely in Python, so it needs no MySQL client libraries and no compilation to run. The Classic API follows the Python Database API Specification v2.0 (PEP 249), so code written against it looks like other Python DB drivers.
Is mysql-connector-python free to use? What license does it have?
mysql-connector-python is open source under the Other license. Check the license terms before using it in commercial products.
Is mysql-connector-python still maintained?
Actively maintained. The last commit to mysql-connector-python was on Oct 22, 2026.
What can I use mysql-connector-python for?
Connecting a Python application or service to a MySQL database. Working with MySQL Document Store collections through X DevAPI. Building LLM or ML prototypes on data stored in HeatWave.
How do I install mysql-connector-python?
Install the Classic API connector with pip: pip install mysql-connector-python Connect to a MySQL server and run a query using the sample code from the README
Where can I get mysql-connector-python?
The source code and installation instructions are on GitHub: https://github.com/mysql/mysql-connector-python

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects