mysql2
npmv3.24.4TypeScriptfast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
Safe to adopt
Yes — mysql2 scores well across adoption, maintenance, weight, supply chain, and licensing. 10.5M downloads per week and 3 known dependents. Last published 2 days ago. 50 releases in the last 2 years.
- AAdoption: grade A, Excellent.
10.5M downloads per week and 3 known dependents.
- AMaintenance: grade A, Excellent.
Last published 2 days ago. 50 releases in the last 2 years.
- BWeight: grade B, Good.
Pulls in 9 transitive packages, about 1.4 MB installed (at least — some of the tree is still being crawled).
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding mysql2 to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.
Licenses in the dependency tree
Every license you inherit by installing mysql2, not just its own. Check this before a legal review, not after.
Compatibility
- Node.js
- node >= 8.0
- Module format
- CommonJS only
- TypeScript
- Types included
- Install scripts
- None
mysql2 vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| mysql2this page | 10.5M | 3 | MIT | 2 days ago |
| toad-cache | 0 | 1 | MIT | 1 day ago |
| send | 127.6M | 3 | MIT | 1 day ago |
| axios | 106.5M | 4 | MIT | 1 day ago |
| follow-redirects | 91.6M | 2 | MIT | 1 day ago |
| next | 40.6M | 0 | MIT | 1 day ago |
Dependencies
Declared by mysql2 v3.24.4. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (7)
Peer (1)
Dev (17)
Used by
Popular packages that depend on mysql2.
Relationship graph
Dependencies (left) and dependents (right) of mysql2.
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 node
TypeScript definitions for better-sqlite3
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.
Prettier is an opinionated code formatter
TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files
Asynchronous, non-blocking SQLite3 bindings
The semantic version parser used by npm.
BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
Simple and robust resource pool for node.js
Release history
50 releases in the last two years, typically about 0 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 3.24.4latest | 2 days ago | 615 KB | MIT |
| 3.24.4-canary.e5833be | 2 days ago | 615 KB | MIT |
| 3.24.4-canary.2387daf | 3 days ago | 615 KB | MIT |
| 3.24.4-canary.9178c82 | 3 days ago | 596 KB | MIT |
| 3.24.3 | 8 days ago | 594 KB | MIT |
| 3.24.3-canary.1281e1e | 10 days ago | 594 KB | MIT |
| 3.24.2 | 16 days ago | 594 KB | MIT |
| 3.24.2-canary.87579e1 | 16 days ago | 594 KB | MIT |
| 3.24.2-canary.1dcd8ef | 16 days ago | 594 KB | MIT |
| 3.24.2-canary.de56272 | 16 days ago | 593 KB | MIT |
| 3.24.1 | 17 days ago | 593 KB | MIT |
| 3.24.1-canary.183e947 | 17 days ago | 593 KB | MIT |
| 3.24.0 | 17 days ago | 591 KB | MIT |
| 3.23.5-canary.f3a60bc | 17 days ago | 591 KB | MIT |
| 3.23.5-canary.c86fe5a | 17 days ago | 589 KB | MIT |
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 10.5M downloads per week and 3 known dependents in the graph. The latest version is 3.24.4, 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 (10.5M weekly downloads).
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
Cons
- Large dependency tree (25 direct dependencies) increases install size and audit surface.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use mysql2?
Yes — mysql2 scores well across adoption, maintenance, weight, supply chain, and licensing. 10.5M downloads per week and 3 known dependents. Last published 2 days ago. 50 releases in the last 2 years.
How do I install mysql2?
Run `npm install mysql2` to add mysql2 to your npm project.
How many dependencies does mysql2 have?
mysql2 declares 25 direct dependencies and pulls in 9 packages in total once its runtime tree is resolved totalling about 1.4 MB on disk.
What license is mysql2 released under?
mysql2 is distributed under the MIT license. Its dependency tree also includes: Apache-2.0, MIT.
How popular is mysql2?
mysql2 has approximately 10,545,301 downloads per week and 3 known dependent packages.
Is mysql2 still maintained?
The most recent release of mysql2 (v3.24.4) was published 2 days ago.
Does mysql2 run install scripts?
No. mysql2 does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.