What is the difference between MySQL & MySQL2 considering NodeJS

Extract from https://www.npmjs.com/package/mysql2

"MySQL2 is mostly API compatible with mysqljs 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"

Only for the first two features is better: Faster and Secure


This is just 2 different APIs written by regular people. Difference is in syntax of commands and maybe in performance, just install both, make your own tests for your goals and choose one you think is more suitable for you.

Here is a comparison by NPMCompare:


I had a lot of problems implementing npm i mysql dependency in my project. First off, if you are following MVC architecture mysql becomes tedious when it comes to extract and send data between server and client. npm i mysql2 simplifies this process, like executing a query is as easy as this

for mysql dependency connection.query(sql,(err,res)=>{*some fn here*}) returns all the rows including the success outcomes of a query. Whereas mysql2 dependency connection.execute(sql) returns onl;y the results from the query and not the rows.