MySQL2 is a fast MySQL-compatible MySQL client for Node.js, focused on performance. It supports features like prepared statements, non-utf8 encodings, binary log protocol, compression, SSL, authentication switching, custom streams, and pooling. It is useful for building Node.js applications that need a MySQL client with broad feature support and good performance.
Project status
- Actively maintained: the last upstream push was on 2026-09-02, and multiple new
updates(v3.24.x) arrived in late Aug to early Sep 2026, including bug fixes and performance improvements. - Apparent cadence: frequent, roughly weekly to sub-weekly updates across 2026-07 to 2026-09, with v3.24.0 on 2026-08-23 and follow-ups v3.24.1 (2026-08-24), v3.24.2 (2026-08-24), and v3.24.3 (2026-09-02).
AI summary generated
Recent updates
v3.24.4
v3.24.4 is presented as a performance-only release. The release notes specifically call out reduced per-query overhead, faster local date handling, faster short-string decoding, improvements around TLS context and compression, and reuse of TLS sessions across connections.
v3.24.3
v3.24.3 is a small release focused on a TypeScript typing correction for PoolCluster event payloads. It adjusts the declared type of the nodeId argument emitted by PoolCluster node lifecycle events.
Breakingv3.24.2
v3.24.2 is a bug fix release. It corrects the packet size calculation for length-coded numbers in the 3 byte (0xFD tag) range, and updates promise wrapper behavior so stack traces are no longer captured when `trace: false` is set.
v3.24.1
v3.24.1 focuses on performance by reducing outgoing UTF-8 encoding work. The code introduces a fast path that uses Buffer.prototype.utf8Write and a new Packet writer for length-coded UTF-8 strings across prepared statements, queries, and typed parameters.
v3.24.0
v3.24.0 adds “typed parameters” support, including adopting integer types based on what the MySQL server reports for placeholders. It also includes a bug fix for how zero dates are returned when `dateStrings` is enabled, along with multiple allocation and serialization performance optimizations. The code diff, however, contains several additional behavioral and API-surface changes that are not mentioned in the release notes.
Featuresv3.23.4
v3.23.4 primarily contains a bug fix for parsing and formatting TIME fractional seconds so leading zeros are preserved. It also updates TypeScript typings for Pool and PoolConnection to better match runtime behavior, and includes supporting tests and documentation updates.
v3.23.3
v3.23.3 contains several targeted bug fixes around query named placeholders, connection timeout handling during handshake, and Pool correctness and error propagation. It also replaces the `denque` dependency with an internal `ring_queue` implementation.
v3.23.2
v3.23.2 contains two documented bug fixes related to the ChangeUser packet and to how a failed Execute is handled. The code changes also include additional error and timeout handling behavior in the Execute command beyond what is explicitly stated in the release notes.
v3.23.1
v3.23.1 includes a security fix for compressed-packet handling, preventing unbounded decompression from server-supplied compressed data. It also corrects binary-protocol NULL handling so user-provided typeCast functions are now called for NULL columns (matching behavior closer to the text protocol).
Securityv3.23.0
mysql2 v3.23.0 adds MariaDB extended column type metadata support (UUID, INET4, INET6, VECTOR, JSON) and enhances JSON parsing so unsafe integers inside JSON can be returned as exact strings when supportBigNumbers is enabled. The implementation also introduces MariaDB-specific protocol negotiation and changes prepared statement encoding for JSON parameters to accommodate MariaDB protocol limitations.
Featuresv3.22.6
v3.22.6 is a small bugfix release focused on the `sql-escaper` behavior around multi-statement handling and object placeholder expansion. The code diff itself shows mostly documentation and comment spelling changes, with the main functional change coming from a `sql-escaper` dependency bump and an added regression test.
v3.22.5
Release v3.22.5 contains a targeted bug fix related to how mysql2 formats TIMESTAMP values in the binary protocol when the `dateStrings` option is enabled. The change ensures TIMESTAMP values keep the `00:00:00` time component (matching the behavior for DATETIME) and adds an integration test to cover it.
v3.22.4
v3.22.4 is a small bug fix release focused on pool shutdown behavior. When a pool is ended while requests are queued, those queued requests are now rejected instead of waiting for connections to become available.
v3.22.3
v3.22.3 primarily adjusts connection configuration validation to accept the resetOnRelease option. The code changes are small and localized, with additional lockfile-only dependency updates (mostly dev tooling and website UI dependencies).
v3.22.2
v3.22.2 focuses on improving promise API error stack traces so the reported rejection stack points to the caller. The implementation changes how promise wrappers capture and rewrite stack traces across connection, pool, and prepared statement operations.
v3.22.1
v3.22.1 contains two documented bug fixes: improved async stack traces for promise-based clients, and correct handling of zero dates as INVALID_DATE when numeric timezone offsets are used. The code changes also include internal adjustments to how promise-wrapper errors are constructed, plus additional regression tests and dependency updates in lockfiles.
v3.22.0
v3.22.0 introduces a new COM_RESET_CONNECTION implementation and adds a connection-level reset API, with optional pool integration. It also disables the mysql_clear_password authentication plugin by default for security, unless the client explicitly opts in. Promise wrapper error handling was adjusted to reduce unnecessary Error allocations.
BreakingSecurityFeaturesv3.21.1
v3.21.1 primarily fixes MySQL handshake capability negotiation by masking client capability flags against server-advertised capabilities during handshake response parsing. It also corrects bigint/big-number boundary handling by switching the number-vs-string decision to use Number.isSafeInteger. The release includes new regression tests covering both areas.
Breakingv3.21.0
v3.21.0 adds support for MySQL query attributes, wiring an `attributes` option through the COM_QUERY and COM_STMT_EXECUTE protocol paths. It also updates TypeScript typings to export `ExecuteValues` and `QueryValues` from the entry point.
Featuresv3.20.0
v3.20.0 introduces native APM tracing support using Node's diagnostics_channel TracingChannel hooks for connection lifecycle events (connect, pool connect, query, execute). It also fixes MySQL auth plugin encryption details (RSA OAEP parameters), prevents double release issues in the connection pool, and restores PoolConnection as a subclass of Connection.
BreakingFeatures