mysql2
npmv3.23.0TypeScriptfast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
Overview
mysql2 is an npm package that fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS. It is extremely widely used, with about 12.4M downloads per week and 1 known dependents in the graph. The latest version is 3.23.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to minimize your dependency tree, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (12.4M weekly downloads).
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
Cons
- Large dependency tree (34 direct dependencies) increases install size and audit surface.
Auto-generated from collected registry metadata. No external claims are inferred.
Relationship graph
Dependencies (left) and dependents (right) of mysql2.
Dependencies
Runtime (8)
Peer (1)
Dev (25)
Used by
Popular packages that depend on mysql2.
Alternatives to mysql2
LRU and FIFO caches for Client or Server
Better streaming static file server with Range and conditional-GET support
Promise based HTTP client for the browser and node.js
The React Framework
Drizzle ORM package for SQL databases
sql named placeholders to unnamed compiler
Fastest full featured PostgreSQL client for Node.js
AWS RDS SSL certificates bundles.
Type safe SQL query builder
A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3
🛡️ Faster SQL escape and format for JavaScript (Node.js, Bun, and Deno).
A Fetch API-compatible PlanetScale database driver
Frequently installed together
PostgreSQL client - pure javascript & libpq with the same API
The fastest and simplest library for SQLite in Node.js.
TypeScript definitions for pg
TypeScript definitions for better-sqlite3
Asynchronous, non-blocking SQLite3 bindings
TypeScript definitions for node
PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 3.7mb gzipped.
The semantic version parser used by npm.
Prettier is an opinionated code formatter
TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files
Fastest full featured PostgreSQL client for Node.js
Type safe SQL query builder
Version history
| Version | Published | License |
|---|---|---|
| 3.23.0latest | 4 days ago | MIT |
| 3.22.7-canary.6b933f6 | 6 days ago | MIT |
| 3.22.7-canary.a26ff14 | 8 days ago | MIT |
| 3.22.7-canary.5034e57 | 9 days ago | MIT |
| 3.22.6 | 12 days ago | MIT |
| 3.22.6-canary.1b927a9 | 12 days ago | MIT |
| 3.22.5 | 1 month ago | MIT |
| 3.22.5-canary.2af33a1 | 1 month ago | MIT |
| 3.22.4 | 1 month ago | MIT |
| 3.22.3 | 2 months ago | MIT |
| 3.22.3-canary.e72f923d | 2 months ago | MIT |
| 3.22.2 | 2 months ago | MIT |
| 3.22.2-canary.c79a3f32 | 3 months ago | MIT |
| 3.22.1 | 3 months ago | MIT |
| 3.22.1-canary.5b6206c8 | 3 months ago | MIT |
| 3.22.1-canary.cb5adccb | 3 months ago | MIT |
| 3.22.0 | 3 months ago | MIT |
| 3.21.2-canary.ab131de5 | 3 months ago | MIT |
| 3.21.2-canary.49a64cca | 3 months ago | MIT |
| 3.21.2-canary.884bec56 | 3 months ago | MIT |
Maintainers
Frequently asked questions
How do I install mysql2?
Run `npm install mysql2` to add mysql2 to your npm project.
What license is mysql2 released under?
mysql2 is distributed under the MIT license.
How popular is mysql2?
mysql2 has approximately 12,397,777 downloads per week and 1 known dependent packages.