skillfed

PyMySQL

Pure Python MySQL Driver

pymysql Permissive license MIT Active 7,845 v1.2.0 released

Install

pymysql on PyPI

pip

pip install pymysql

uv

uv add pymysql

poetry

poetry add pymysql

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 86 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: pymysql-1.2.0-py3-none-any.whl

Keywords: MySQL

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database

About PyMySQL

from the package's own PyPI description — quoted content, verbatim

Documentation Status (image) codecov (image) Ask DeepWiki (image)

PyMySQL

This package contains a pure-Python MySQL and MariaDB client library, based on PEP 249.

Requirements

  • Python -- one of the following:
  • CPython : 3.9 and newer
  • PyPy : Latest 3.x version
  • MySQL Server -- one of the following:
  • MySQL LTS versions
  • MariaDB LTS versions

Installation

Package is uploaded on PyPI.

You can install it with pip:

$ python3 -m pip install PyMySQL

To use "sha256_password" or "caching_sha2_password" for authenticate, you need to install additional dependency:

$ python3 -m pip install PyMySQL[rsa]

To use MariaDB's "ed25519" authentication method, you need to install additional dependency:

$...

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Pure-Python MySQL and MariaDB client library implementing PEP 249, enabling direct database connections without compiled dependencies.

Low install friction with no runtime dependencies; actively maintained with recent commits and 7845 repository stars. Supports Python 3.9+ on CPython and PyPy.

MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects.

Usage

import pymysql.cursors

connection = pymysql.connect(host='localhost',
                             user='user',
                             password='passwd',
                             database='db')
with connection.cursor() as cursor:
    cursor.execute("SELECT * FROM users")
    result = cursor.fetchone()

Requires MySQL Server (LTS) or MariaDB (LTS) running and accessible; Python 3.9 or newer required. Optional: install PyMySQL[rsa] for sha256_password/caching_sha2_password or PyMySQL[ed25519] for MariaDB ed25519 auth.

Verdict: Stable, actively maintained pure-Python MySQL driver with no runtime dependencies and permissive MIT licensing. Zero known vulnerabilities and top-1000 popularity make it a reliable choice for Python-to-MySQL connectivity.

Needs verification

  • Performance characteristics compared to compiled alternatives (e.g., mysqlclient) for high-throughput scenarios
  • Whether optional dependencies (rsa, ed25519) are pre-installed or require explicit installation for those auth methods
python mysql client librarypure python database drivermysql connection librarymariadb python connectorpep 249 database adaptermysql query executionlightweight mysql driver

Similar packages