# felixge/node-mysql

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/felixge-node-mysql).**

18,621 stars · 2,515 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/felixge/node-mysql
- awesome-repositories: https://awesome-repositories.com/repository/felixge-node-mysql.md

## Description

This project is a pure JavaScript database driver for Node.js that implements the native MySQL binary protocol. It serves as a comprehensive connector for managing persistent network links to MySQL servers, enabling applications to execute queries, manage transactions, and handle complex data operations without requiring external middleware.

The driver distinguishes itself through its integrated support for connection pooling and distributed database routing. It maintains managed sets of reusable network sockets to optimize resource usage under high request volumes, while simultaneously providing automated clustering capabilities to distribute traffic across multiple server nodes. These features are complemented by built-in security mechanisms, including template-based query sanitization and identifier escaping, which protect against injection vulnerabilities by automatically handling input formatting.

Beyond core connectivity, the library provides extensive support for memory-efficient data handling through stream-based result processing, allowing large datasets to be consumed row by row. It also includes robust observability and lifecycle management tools, such as communication tracing, connection health verification, and event-based monitoring for session states. The driver further supports advanced database interactions, including multi-statement execution, stored procedure handling, and secure data transmission via encrypted protocols.

## Tags

### Data & Databases

- [MySQL Connectors](https://awesome-repositories.com/f/data-databases/database-connectivity/mysql-connectors.md) — Implements the native MySQL binary protocol to enable Node.js applications to execute queries and manage database connections.
- [Node.js Connectors](https://awesome-repositories.com/f/data-databases/mysql-integrations/node-js-connectors.md) — Connects Node.js applications to MySQL servers to execute queries, manage transactions, and handle data retrieval through a native protocol.
- [Connection Establishment](https://awesome-repositories.com/f/data-databases/connection-establishment.md) — Establishes persistent network links to database servers using host details and authentication credentials to ensure reliable data access. ([source](https://github.com/felixge/node-mysql#readme))
- [Connection Pools](https://awesome-repositories.com/f/data-databases/connection-pools.md) — Maintains a set of reusable database connections to optimize resource usage and handle high request volumes in web applications.
- [Parameterized SQL Templates](https://awesome-repositories.com/f/data-databases/data-querying/sql-templating-engines/parameterized-sql-templates.md) — Prevents injection vulnerabilities by automatically escaping and binding user-provided values into SQL templates before transmission to the server.
- [Binary Protocols](https://awesome-repositories.com/f/data-databases/data-serialization-formats/binary-serialization-protocols/binary-protocols.md) — Communicates directly with the database server using its binary wire protocol to eliminate the need for external middleware.
- [Database Connection Managers](https://awesome-repositories.com/f/data-databases/database-connection-managers.md) — Maintains a managed set of reusable network sockets to optimize resource usage and handle high volumes of concurrent database requests.
- [Database Transaction Wrappers](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/connection-transaction-management/atomic-transactions/atomic-transactional-commits/database-transaction-wrappers.md) — Provides mechanisms for wrapping multiple database queries within a single transaction session to ensure atomicity and data consistency. ([source](https://github.com/felixge/node-mysql#readme))
- [Connection Pool Managers](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/connection-transaction-management/connection-pool-managers.md) — Maintains a collection of reusable database connections with configurable limits and queuing behavior to optimize resource usage. ([source](https://github.com/felixge/node-mysql#readme))
- [Database Wire Protocol Implementations](https://awesome-repositories.com/f/data-databases/database-wire-protocol-implementations.md) — Communicates directly with the database server using its binary wire protocol without requiring external client libraries or middleware.
- [Placeholder-Based SQL Templates](https://awesome-repositories.com/f/data-databases/expression-based-data-querying/fluent-query-apis/sql-syntax-tree-construction/placeholder-based-sql-templates.md) — Constructs secure query strings by injecting values into placeholders and applying automatic escaping to prevent injection. ([source](https://github.com/felixge/node-mysql#readme))
- [Connection Pooling](https://awesome-repositories.com/f/data-databases/high-concurrency-database-access/connection-pooling.md) — Maintains a managed set of reusable network sockets to minimize the overhead of repeatedly establishing new database connections.
- [Relational Database Connectors](https://awesome-repositories.com/f/data-databases/relational-database-connectors.md) — Establishes persistent network connections to relational databases for reliable data exchange and transaction management.
- [SQL Query Execution](https://awesome-repositories.com/f/data-databases/sql-query-execution.md) — Executes SQL statements and retrieves structured results including metadata like affected row counts and generated IDs. ([source](https://github.com/felixge/node-mysql#readme))
- [Cluster Connectivity](https://awesome-repositories.com/f/data-databases/cluster-connectivity.md) — Distributes incoming database requests across multiple server nodes and automatically removes unresponsive nodes from the rotation. ([source](https://github.com/felixge/node-mysql#readme))
- [Asynchronous Callbacks](https://awesome-repositories.com/f/data-databases/data-exchange-protocols/runtime-data-exchange/asynchronous-callbacks.md) — Processes database operations using non-blocking callbacks to handle concurrent requests without stalling the main application thread.
- [Connection Health Maintenance](https://awesome-repositories.com/f/data-databases/database-connectivity/connection-health-maintenance.md) — Performs automatic validation of database connections to ensure they remain active and responsive. ([source](https://github.com/felixge/node-mysql#readme))
- [Distributed Databases](https://awesome-repositories.com/f/data-databases/distributed-databases.md) — Distributes database requests across multiple server nodes to improve performance and ensure high availability through automated connection clustering.
- [Result Streaming](https://awesome-repositories.com/f/data-databases/query-result-fetching/result-streaming.md) — Provides memory-efficient incremental retrieval of database rows to handle large datasets without exhausting system memory.
- [Row-Based Result Streaming](https://awesome-repositories.com/f/data-databases/row-based-result-streaming.md) — Exposes query results as readable streams to allow memory-efficient handling of large datasets by processing rows as they arrive.
- [SQL Query Builders](https://awesome-repositories.com/f/data-databases/sql-query-builders.md) — Provides utilities for constructing and sanitizing SQL queries to prevent injection vulnerabilities.
- [Batch Statement Execution](https://awesome-repositories.com/f/data-databases/sql-statement-parsing/statement-executions/batch-statement-execution.md) — Executes multiple SQL commands within a single request to process complex data operations efficiently. ([source](https://github.com/felixge/node-mysql#readme))
- [Stored Procedures](https://awesome-repositories.com/f/data-databases/stored-procedures.md) — Executes pre-defined database routines and processes multiple returned result sets using a consistent interface. ([source](https://github.com/felixge/node-mysql#readme))

### Security & Cryptography

- [Input Sanitization](https://awesome-repositories.com/f/security-cryptography/application-and-system-security/web-security/input-sanitization.md) — Cleans and validates user-provided data to prevent SQL injection attacks through automatic escaping and placeholder substitution. ([source](https://github.com/felixge/node-mysql#readme))
- [SQL Injection Prevention](https://awesome-repositories.com/f/security-cryptography/sql-injection-prevention.md) — Sanitizes user inputs and escapes query identifiers to ensure database commands are executed safely and protected against malicious injection attacks.
- [Identifier Escaping](https://awesome-repositories.com/f/security-cryptography/database-query-security/identifier-escaping.md) — Sanitizes database, table, and column names to ensure they are treated as literal identifiers and prevent injection. ([source](https://github.com/felixge/node-mysql#readme))
- [SSL/TLS Connection Security](https://awesome-repositories.com/f/security-cryptography/ssl-tls-connection-security.md) — Implements secure transport layers using SSL or TLS to encrypt database traffic between clients and servers. ([source](https://github.com/felixge/node-mysql#readme))

### DevOps & Infrastructure

- [Connection Termination](https://awesome-repositories.com/f/devops-infrastructure/client-connectivity-tools/connection-termination.md) — Closes a connection to the database by finishing pending queries gracefully or by immediately destroying the underlying socket. ([source](https://github.com/felixge/node-mysql#readme))

### Networking & Communication

- [Connection Lifecycle Managers](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/connection-session-management/connection-management/connection-lifecycle-managers.md) — Opens and gracefully closes database sessions, ensuring all pending operations complete before terminating the network link to the server. ([source](https://github.com/felixge/node-mysql#readme))

### Software Engineering & Architecture

- [Cluster Load Balancing](https://awesome-repositories.com/f/software-engineering-architecture/cluster-load-balancing.md) — Distributes database traffic across multiple server nodes by monitoring connection health and routing queries based on configurable selection strategies.

### Part of an Awesome List

- [Database Drivers](https://awesome-repositories.com/f/awesome-lists/devtools/database-drivers.md) — Provides a driver for interacting with relational databases.
