Elestia Open Source Ratings
8.0

MySQL2

A strong pick. 4th of 10 database drivers.

MySQL2 is the standard pure-JavaScript MySQL and MariaDB driver for Node.js, with promises, prepared statements, pooling and bundled TypeScript types. If you are starting a new project on MySQL today, it is the default pick. It is actively maintained. Its security record is mixed but well handled.

Best for: Node.js teams on MySQL, MariaDB or Aurora MySQL that want a mature driver, either used directly or under Drizzle, Kysely, Knex, TypeORM or Sequelize.

WebsiteGitHubnpm

Scores

Overall8.0

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 7.5, likely 6.5 to 8.5

For MySQL in Node.js it is the default driver, and it is well maintained and growing. It ranks below node-postgres as a category pick because it serves a narrower database family. Its advisory record is also heavier, and the mariadb connector may be faster for MariaDB-specific workloads.

GPT-6.2 Sol: 8.4, likely 7.3 to 9.3

MySQL2 is a strong choice for a new Node.js project using MySQL because it covers the core driver features, ships regular fixes, and has support from major tools and platforms. In this category the database choice determines the relevant peer, with node-postgres serving PostgreSQL and better-sqlite3 serving local SQLite. The reported TypeScript regression and gaps in release safeguards keep MySQL2 below the top tier.

Needed by many5.2

How many developers need a tool for this job?

Claude Opus 5.5: 5.5, likely 4.5 to 6.5

Most backend developers need a database driver, but this one only serves MySQL and MariaDB. MySQL is still one of the most widely used databases, while new JS projects lean more towards Postgres and SQLite. That makes it a large group, but not a majority.

  • peers downloadsLast4Weeks: node-postgres has about 4x the downloads, which shows Postgres leads in JS
  • Stack Overflow Developer Survey: MySQL ranks among the top databases, behind PostgreSQL

GPT-6.2 Sol: 4.8, likely 3.7 to 5.9

Database drivers serve a wide range of backend projects, and 35.1% of database respondents in the 2026 Stack Overflow survey reported using MySQL. MySQL2 serves MySQL-compatible databases and is built around Node.js APIs, with support on Cloudflare Workers through its compatibility layer. The survey covers multiple languages and leaves the share of JavaScript and TypeScript projects that need this driver uncertain.

Helps a lot8.0

How well does it do the job for those who need it?

Claude Opus 5.5: 7.5, likely 6.5 to 8.5

It is a full-featured driver: promise and callback APIs, prepared statements, pooling, SSL, compression, binlog and named placeholders, plus bundled types. AI agents write correct code for it easily because its API is widely known. Recent work fixed performance problems, but a vendor benchmark still shows the mariadb connector faster, and it lacks native batch and pipelining. The range is moderate because the speed gap comes from one vendor source and is outdated.

GPT-6.2 Sol: 8.5, likely 7.4 to 9.4

Version 3.24.6 covers routine MySQL work with pools, cached prepared statements, TLS, Promise and callback APIs, and bundled types. The quickstart gives coding agents examples to follow, though callers still supply row shapes and the parameter types reject some valid JSON objects. Fluxify measured faster concurrent reads with Bun SQL but kept MySQL2 for its connection setup hooks. That test leaves performance on current Node.js workloads less certain.

Holds up over time8.1

Will it still be a good choice in two years?

Claude Opus 5.5: 8.0, likely 7.0 to 9.0

Activity is high: 536 commits and 37 releases in the last year, a push the day before the data was read, and 287 contributors. Version 3.x has kept its API stable for years. The project is led by its original author plus at least one very active co-maintainer, but it has no clear corporate funding. That gap keeps the score below 9.

GPT-6.2 Sol: 8.1, likely 6.9 to 9.1

MySQL2 recorded 536 commits and 37 releases in the past year, with more commits than any listed peer. The release history shows regular fixes within the 3.x line, although a parameter typing regression reported in April remains open. Public sponsorship is listed for one maintainer, and funding and release authority are unclear.

Used widely7.5

How many use it, and is that growing?

Claude Opus 5.5: 8.0, likely 7.0 to 9.0

It has about 96M downloads per 4 weeks, up from 15M a year ago. That ratio of about 6.3 is above the 4.1 median, so it is gaining ground. It has 126,697 dependent repos and 4,001 dependent packages, second among SQL drivers after node-postgres. Many downloads come through ORMs and query builders, but those still reflect people choosing MySQL.

  • npm downloadsLast4Weeks: 96.4M, against 15.4M a year before
  • dependents: 126,697 repos and 4,001 packages
  • medianDownloadsRatio: Its ratio of 6.3 beats the 4.1 median

GPT-6.2 Sol: 7.0, likely 5.9 to 8.0

Downloads rose 6.3-fold year over year, ahead of the 4.1-fold catalog median and behind node-postgres at 8.3-fold. The sampled 126,697 dependent repositories put MySQL2 below node-postgres and the MongoDB driver, and well above better-sqlite3 on this measure. Automated installs and use through ORMs make direct choices hard to isolate, and the single Bluesky post adds little evidence about momentum.

  • npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 96.4 million versus 15.4 million downloads in matching four-week windows
  • dependents, peers: 126,697 sampled repositories and 4,001 npm packages depend on MySQL2
  • bluesky.posts: One repository-linked post in 24 months
  • sequelize.org/docs/v6/other-topics/dialect-specific-things: Some installs reflect a choice to use Sequelize with MySQL
Vouched for7.7

Who stands behind it being good?

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

Major tools build on it: Drizzle ships a native mysql2 integration, and Cloudflare Hyperdrive documents it as the MySQL driver to use. Kysely, Knex, TypeORM and Sequelize also rely on it. It has little independent survey or benchmark coverage, and the one benchmark found comes from a competitor.

GPT-6.2 Sol: 8.4, likely 7.4 to 9.3

Cloudflare recommends MySQL2 for Hyperdrive, and Sequelize, Kysely, and Drizzle build their MySQL support on it. Fluxify publicly documented keeping it after testing an alternative. That is direct evidence of downstream trust, while driver-specific satisfaction and independent benchmarks on current Node.js remain sparse.

Safe6.6

How safe is it to depend on?

Claude Opus 5.5: 6.0, likely 5.0 to 7.0

It has 7 advisories in total. These include two critical code-injection and RCE flaws in 2024, and two new ones in 2026: a credential leak through a cleartext auth downgrade, and a decompression-bomb DoS. All are fixed; the credential leak was fixed in 3.22.0 behind a new opt-in flag. The Scorecard is 6.5, with weak token-permissions, branch-protection and fuzzing checks. It pulls in 7 dependencies and is MIT licensed.

  • advisories: 7 in total, 2 in the last 24 months, including critical RCEs in 2024
  • advisories.gitlab.com/npm/mysql2/GHSA-3f6p-5ww8-9rcr: Cleartext credential leak fixed in 3.22.0
  • scorecard: Score 6.5; Token-Permissions, Branch-Protection and Fuzzing score 0
  • npm dependencies: 7 dependencies

GPT-6.2 Sol: 7.1, likely 5.9 to 8.1

The MIT-licensed package has seven direct dependencies, and its release workflow publishes to npm with provenance and a stored token. The current version includes fixes for both 2026 advisories, with patches available by public disclosure. Earlier critical issues also received patches. The 6.5 OpenSSF Scorecard shows strong code review and a security policy, with weak checks for token permissions, branch protection, dependency pinning, and fuzzing.

Good

  • Mostly a drop-in, API-compatible replacement for the old mysql package, and it adds native promises and prepared statements.
  • Most JS query builders and ORMs that support MySQL list it as their driver, including Drizzle, Kysely, Knex, TypeORM and Sequelize.
  • Very active releases, about 37 in the last year, including recent performance work and fixes for Aurora failover.
  • Pure JavaScript with no native build step, and TypeScript types are bundled.

Bad

  • It has a history of serious advisories: two critical RCE flaws in 2024 and two new ones in 2026, all fixed.
  • A benchmark by MariaDB, a vendor, shows the mariadb connector clearly faster on prepared statements and batch inserts.
  • It only serves MySQL-family databases, and the backlog is large at about 400 open issues.
  • Typing query results is loose: rows come back as generic RowDataPacket types unless you cast them.

The numbers

npm downloads, 4 weeks
96M ×6.3 in a year
GitHub stars
4.4k
Commits, 12 months
536
npm version
3.24.6 Oct 2026
Versions, 12 months
37
Advisories, 24 months
2 of 7 ever
OpenSSF Scorecard
6.5 out of 10, Nov 2026
Licence
MIT

Read on 21 November 2026 from GitHub (sidorares/node-mysql2), npm (mysql2), OSV and the OpenSSF Scorecard.

Database drivers

  1. 8.7node-postgres
  2. 8.2MongoDB driver
  3. 8.1better-sqlite3
  4. 8.0MySQL2
  5. 7.6PGlite
  6. 7.5Postgres.js
  7. 7.4DuckDB Node Neo
  8. 7.1Neon serverless driver
  9. 5.9libSQL client
  10. 1.9node-sqlite3
Compare all 10 on six scores