@vita-mojo/mysql2
v3.23.3-vm.1
Published
Vita Mojo fork of mysql2 (upstream 3.23.3) adding the connectionLifeTime pool option: recycles pooled connections by age so they rebalance onto DB nodes added by autoscaling
Readme
MySQL2
⚠️ Vita Mojo fork —
@vita-mojo/mysql2This is a fork of
mysql2(base: upstream 3.23.3) adding one pool option upstream does not have:connectionLifeTime, a maximum connection age in seconds, so pooled connections rebalance onto database nodes added by autoscaling. See VITAMOJO.md for the rationale, the implementation and the release process. Install it asnpm i @vita-mojo/mysql2, or alias it sorequire('mysql2')keeps working:"mysql2": "npm:@vita-mojo/mysql2@<version>".Everything below is upstream's documentation and applies unchanged.
English | 简体中文 | Português (BR)
MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl much more.
Table of Contents
History and Why MySQL2
MySQL2 project is a continuation of MySQL-Native. Protocol parser code was rewritten from scratch and api changed to match popular Node MySQL. MySQL2 team is working together with Node MySQL team to factor out shared code and move it under mysqljs organization.
MySQL2 is mostly API compatible with Node MySQL and supports majority of features. MySQL2 also offers these additional features:
- Faster / Better Performance
- Prepared Statements
- MySQL Binary Log Protocol
- MySQL Server
- Extended support for Encoding and Collation
- Promise Wrapper
- Compression
- SSL and Authentication Switch
- Custom Streams
- Pooling
Installation
MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues.
npm install --save mysql2If you are using TypeScript, you will need to install @types/node.
npm install --save-dev @types/nodeFor TypeScript documentation and examples, see here.
Documentation
Acknowledgements
- Internal protocol is written by @sidorares MySQL-Native.
- Constants, SQL parameters interpolation, Pooling,
ConnectionConfigclass taken from Node MySQL. - SSL upgrade code based on @TooTallNate code.
- Secure connection / compressed connection api flags compatible to MariaSQL client.
- Contributors.
Contributing
Want to improve something in MySQL2? Please check Contributing.md for detailed instruction on how to get started.
To contribute in MySQL2 Documentation, please visit the Website Contributing Guidelines for detailed instruction on how to get started.
