Documentation
MySQL2 aims to be a drop in replacement for Node MySQL.
nota
If you see any API incompatibilities with Node MySQL, please report via github issue.
Not only MySQL2 offers better performance over Node MySQL, we also support these additional features:
- Prepared Statements
- Promise Wrapper
- Authentication Switch
- More Features
- MySQL Server
- Pooling
- SSL
- MySQL Compression
- Binary Log Protocol Client
Examples
Please check these examples for MySQL2.
Known incompatibilities with Node MySQL
-
zeroFill
flag is ignored in type conversion. You need to check corresponding field's zeroFill flag and convert to string manually if this is of importance to you. -
DECIMAL
andNEWDECIMAL
types always returned asstring
unless you pass this config option:
{
decimalNumbers: true,
}
nota
This option could lose precision on the number as Javascript Number is a Float!
- By default, the
JSON
type is always returned parsed into an object. However, you can modify this behavior by specifying the following configuration:
{
jsonStrings: true,
}
Other Resources
- Wire protocol documentation
- Node MySQL - Most popular node.js mysql client library
- node-mariasql - Bindings to libmariasql. One of the fastest clients
- node-libmysqlclient - Bindings to libmysqlclient
- go-mysql - MySQL Go client (prepared statements, binlog protocol, server)
Benchmarks
- https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b
npm run benchmarks
- node-mysql-benchmarks
- try to run example benchmarks on your system