
mysqljs
A pure JavaScript MySQL client for Node.js that talks directly to MySQL servers.mysqljs/mysql
- Stars
- 18.6k
- Forks
- 2.5k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 2.4 years ago
- Type
- Library
No commits in over a year — check for forks or alternatives before adopting.
What it is
This is a Node.js library that lets JavaScript code connect to a MySQL database and run queries. It is written entirely in JavaScript and implements the MySQL wire protocol itself, so it does not depend on a separate native MySQL driver. Developers use it to read and write data from Node.js server applications.
- Connect a Node.js web server to a MySQL database and run SELECT, INSERT, UPDATE and DELETE queries
- Build a REST API backed by MySQL data
- Run a script that imports or exports rows from a MySQL table
Great for
- Node.js backend developers who need to query a MySQL database
- Teams that want a pure JavaScript driver with no native compilation step
- Projects that already run MySQL and want a widely used Node.js client
Not ideal for
- People who are not writing Node.js code, since it is a JavaScript library
- Projects that need a newer, actively promoted driver, because the README was not sufficient to confirm current maintenance status beyond the last push date
- Users of other databases such as PostgreSQL, which need a different client
How to get it
- 1
Install with a package manager
You'll need: Node.js · A running MySQL server
Install the package from npm
npm install mysql - 2
Run it
- Install the package with npm in your Node.js project
- Create a connection object with your host, user, password and database name
- Call connect on the connection and run a query
- Close the connection with end when finished
- 3
Get the most out of it
- Use connection pooling if your application runs many queries concurrently
- Use parameterized queries or escaping to avoid SQL injection
- Check the README for SSL and timeout options when connecting to remote servers
Downloads
Strengths
- Pure JavaScript implementation with no native build dependency
- Widely used, with about 18,600 GitHub stars at the time of metadata capture
- Open source under the MIT license
Trade-offs
- The README provided was truncated, so detailed feature and API coverage could not be fully verified here
- No formal release is listed, so users must rely on the repository's current code or package registry versions
- Being a low-level driver, it leaves query building and schema design to the developer
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| mysql (this) | 18.6k | Library | intermediate | 2.4 years ago | Node.js backend developers who need to query a MySQL database |
| sequelize | 30.3k | Library | intermediate | 5 days ago | Node.js backend developers who use a relational SQL database |
| typeorm | 36.7k | Library | intermediate | 8 days ago | Node.js or TypeScript developers building apps backed by a relational database |
| knex | 20.3k | Library | intermediate | 4 months ago | Node.js developers who need to talk to a SQL database from application code |
| kysely | 14.3k | Library | intermediate | 4 days ago | TypeScript developers who want SQL control without losing compile-time type checks |
| ruoyi-vue-pro | 40.2k | Framework | advanced | 5 days ago | Java developers building an internal admin or back-office system |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.