mariadb
Python MariaDB extension
What it is and what it does
MariaDB Connector/Python is a database adapter that lets Python code connect to MariaDB and MySQL servers using the standard Python DB API 2.0 interface (PEP-249). It wraps the MariaDB Connector/C client library, which handles the low-level protocol and communication. The package is written in C for performance and is actively maintained by MariaDB Corporation.
You use it to execute SQL queries, fetch results, manage transactions, and handle database connections in a way that follows Python's standard database API conventions. It supports modern Python versions (3.9 through 3.14) and runs on Windows, macOS, and POSIX systems. Installation involves compiled extensions, so prebuilt wheels are provided for common platforms to reduce build friction.
Use it for:
- Connect a Python web application to a MariaDB backend for user data, content, or transactional storage.
- Build ETL or data pipeline scripts that read from or write to MariaDB databases.
- Migrate from a legacy MySQL driver to a modern, actively maintained connector with DB API 2.0 compliance.
- Develop system administration or monitoring tools that query MariaDB for operational metrics or configuration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
MariaDB Connector/Python provides a DB API 2.0-compliant interface for Python programs to connect to and query MariaDB and MySQL databases using a C-based client library.
Yes, if you need to connect Python to MariaDB or MySQL and want an actively maintained, production-stable connector. The medium install friction is manageable thanks to prebuilt wheels for common platforms. Be aware of the LGPL 2.1 copyleft license if your application is proprietary, and verify the details of PYSEC-2026-217 before deploying in security-sensitive contexts.
Install
mariadb on PyPI
pip
pip install mariadbuv
uv add mariadbpoetry
poetry add mariadbInstalling mariadb
Before you install
Medium install friction due to compiled C extensions; prebuilt wheels available for Windows and modern Python versions (3.9–3.14), but non-Windows platforms may require build tools. Maintenance is active with recent commits and production-stable status.
License in practice
Licensed under LGPL 2.1 or later (copyleft). Derivative works and modifications must be distributed under compatible terms; proprietary applications linking this library may face licensing constraints.
Quickstart
pip install mariadb
import mariadb
conn = mariadb.connect(
user="user",
password="password",
host="localhost",
database="mydb"
)
cursor = conn.cursor()
cursor.execute("SELECT * FROM table")
for row in cursor:
print(row)
conn.close()
MariaDB Connector/C client library may need to be installed on the host system; consult documentation for platform-specific setup requirements.
Verify before relying
- Whether MariaDB Connector/C client library must be installed separately on the host system for runtime operation.
- Performance characteristics and connection pooling capabilities compared to other MariaDB/MySQL adapters.
- Details on the single known vulnerability PYSEC-2026-217 and whether it affects current usage.
Package facts
| License | LGPL 2.1 (copyleft) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — packaging |
| Maintenance | actively maintained — 311 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 407,124/month — #6,889 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | 1 — PYSEC-2026-217 |
Evidence: mariadb-1.1.14-cp310-cp310-win32.whl; mariadb-1.1.14-cp310-cp310-win_amd64.whl; mariadb-1.1.14-cp311-cp311-win32.whl; mariadb-1.1.14-cp311-cp311-win_amd64.whl; mariadb-1.1.14-cp312-cp312-win32.whl; mariadb-1.1.14-cp312-cp312-win_amd64.whl; mariadb-1.1.14-cp313-cp313-win32.whl; mariadb-1.1.14-cp313-cp313-win_amd64.whl; mariadb-1.1.14-cp314-cp314-win32.whl; mariadb-1.1.14-cp314-cp314-win_amd64.whl; mariadb-1.1.14-cp39-cp39-win32.whl; mariadb-1.1.14-cp39-cp39-win_amd64.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
firebolt-sdkFirebolt-sdk provides a Python DB API…
permissive · top 15,000 on PyPI
mysqlclientmysqlclient provides a Python interface to…
copyleft · top 1,000 on PyPI
PyMySQLPyMySQL is a pure-Python MySQL and MariaDB…
permissive · top 1,000 on PyPI
mysql-connector-pythonMySQL Connector/Python is a PEP 249-compliant…
copyleft · top 1,000 on PyPI
mysql-connector-python-rfA pure-Python MySQL driver that implements the…
copyleft · top 15,000 on PyPI
mysql-connectorMySQL driver written in Python that enables…
copyleft · top 5,000 on PyPI
PIconnectPIconnect provides Python access to OSIsoft PI…
permissive · top 15,000 on PyPI
fdbFDB is a Python Database API 2.0-compliant…
permissive · top 15,000 on PyPI
pyodbcpyodbc provides Python access to ODBC databases…
permissive · top 1,000 on PyPI
firebird-driverA Python Database API 2.0-compliant driver for…
permissive · top 15,000 on PyPI