aiomysql
MySQL driver for asyncio.
Decision gist · record as of 2026-08-14
Yes. aiomysql is a straightforward, low-friction async MySQL driver with active maintenance, no security issues, permissive licensing, and broad Python version support. Install it if you need non-blocking MySQL access in an asyncio application; the single dependency (PyMySQL) and pure-Python wheel keep setup simple.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running MySQL server and valid connection credentials; Python 3.9 or later.
- Low friction: pure Python wheel with a single runtime dependency (PyMySQL).
- Actively maintained with recent commits and a stable repository; marked Alpha but in use across a broad Python version range (3.9–3.13).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute aiomysql with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2025-10-22 (296 days) · last repo commit 2026-03-27 · 1,895 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 16,758,493 downloads/mo, #1,140 on PyPI
Alternatives
Verify before relying
import asyncio
import aiomysql
async def query():
async with aiomysql.create_pool(host='127.0.0.1', user='root', db='mysql') as pool:
async with pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute("SELECT 42;")
result = await cur.fetchone()
print(result)
asyncio.run(query())- Whether the Alpha status (Development Status :: 3) reflects active development or stable-but-unversioned API.
- Performance characteristics compared to other async MySQL drivers in production workloads.
- Compatibility with MariaDB versions beyond basic keyword mention.
What it is and what it does
aiomysql is an async wrapper around PyMySQL that lets you execute MySQL queries without blocking your asyncio event loop. It reuses PyMySQL's connection logic and SQL parsing but replaces all blocking I/O calls with async equivalents, so you can use `await` and `async with` to manage connections, cursors, and queries. The API mirrors PyMySQL closely, making it familiar if you've used that library, and it includes optional SQLAlchemy integration ported from aiopg for ORM-style queries.
You create a connection pool with `create_pool()`, acquire connections from it, and execute queries through cursors—all with `await`. It supports both raw SQL and SQLAlchemy table operations, and works across Python 3.9 through 3.13. The package is actively maintained, has no known vulnerabilities, and carries an MIT license.
Use it for
- Build async web services (FastAPI, aiohttp) that query MySQL without blocking the event loop.
- Write concurrent batch jobs that fetch or insert data into MySQL from multiple coroutines.
- Integrate MySQL with SQLAlchemy in async frameworks using the `aiomysql.sa` module.
- Handle high-concurrency scenarios where traditional blocking drivers would exhaust thread pools.
- Migrate from aiopg to MySQL while preserving async/await patterns and similar API structure.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
aiomysql is a straightforward, low-friction async MySQL driver with active maintenance, no security issues, permissive licensing, and broad Python version support. Install it if you need non-blocking MySQL access in an asyncio application; the single dependency (PyMySQL) and pure-Python wheel keep setup simple.
Install
aiomysql on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (PyMySQL). Actively maintained with recent commits and a stable repository; marked Alpha but in use across a broad Python version range (3.9–3.13).
Requires a running MySQL server and valid connection credentials; Python 3.9 or later.
License in practice
MIT license is permissive; you may use, modify, and distribute aiomysql with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
import asyncio
import aiomysql
async def query():
async with aiomysql.create_pool(host='127.0.0.1', user='root', db='mysql') as pool:
async with pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute("SELECT 42;")
result = await cur.fetchone()
print(result)
asyncio.run(query())
Verify before relying
- Whether the Alpha status (Development Status :: 3) reflects active development or stable-but-unversioned API.
- Performance characteristics compared to other async MySQL drivers in production workloads.
- Compatibility with MariaDB versions beyond basic keyword mention.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagePyMySQL |
| Maintenance | Actively maintained 296 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 16,758,493 / month, #1,140 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: Web EnvironmentFramework :: AsyncIOIntended Audience :: DevelopersOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: DatabaseTopic :: Database :: Front-Ends |
Evidence: aiomysql-0.3.2-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 › “non-blocking mysql queries”
- aiomysqlaiomysql provides async/await access to MySQL databases by wrapping…
- databasesProvides async database access for PostgreSQL, MySQL, and SQLite…
- hopsworks-aiomysqlAsync MySQL database driver for Python asyncio applications,…
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 aioodbc · aiopg · databases · hopsworks-aiomysql · asyncmy · asyncmy2 · anysqlite · aiosql · PyMySQL · mycli