MySQL2
!NPM Versionnpm-imagenpm-url
!NPM Downloadsdownloads-imagedownloads-url
!Node.js Versionnode-version-imagenode-version-url
!GitHub Workflow Status (with event)ci-imageci-url
!Codecovcoveragecoverage-url
!Licenselicense-imagelicense-urlEnglishdocs-base | 简体中文docs-base-zh-CN | Português (BR)docs-base-pt-BR
MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl much moredocs-documentation.
Table of Contents
History and Why MySQL2
MySQL2 project is a continuation of MySQL-Nativemysql-native. Protocol parser code was rewritten from scratch and api changed to match popular Node MySQLnode-mysql. MySQL2 team is working together with Node MySQLnode-mysql team to factor out shared code and move it under mysqljsmysqljs organization.MySQL2 is mostly API compatible with Node MySQLnode-mysql and supports majority of features. MySQL2 also offers these additional features:
- Faster / Better Performance
- Prepared Statementsdocs-prepared-statements
- MySQL Binary Log Protocol
- MySQL Serverdocs-mysql-server
- Extended support for Encoding and Collation
- Promise Wrapperdocs-promise-wrapper
- Compression
- SSL and Authentication Switchdocs-authentication-switch
- Custom Streamsdocs-streams
- Poolingdocs-qs-pooling
Installation
MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues.npm install --save mysql2
If you are using TypeScript, you will need to install
@types/node
.npm install --save-dev @types/node
For TypeScript documentation and examples, see heredocs-typescript-docs.
Documentation
- First Querydocs-qs-first-query, Using Prepared Statementsdocs-qs-using-prepared-statements, Using Connection Poolsdocs-qs-pooling and more.Acknowledgements
- Internal protocol is written by @sidoraressidorares MySQL-Nativemysql-native.
- Constants, SQL parameters interpolation, Pooling,
ConnectionConfig
class taken from Node MySQLnode-mysql. - SSL upgrade code based on @TooTallNateTooTallNate codestarttls.js.
- Secure connection / compressed connection api flags compatible to MariaSQLnode-mariasql client.
- Contributorscontributors.
Contributing
Want to improve something in MySQL2? Please check Contributing.mdcontributing for detailed instruction on how to get started.To contribute in MySQL2 Documentation, please visit the Website Contributing Guidelinesdocs-contributing for detailed instruction on how to get started.