Registry / database / mysql-node-client

mysql-node-client

JSON →
library1.3.4jsnpmunverified

A lightweight MySQL client wrapper for Node.js that provides a connection pool, CRUD operations (store, update, destroy, list, fetch), DDL methods (createDatabase, listDatabases, createTable, listTables, describeTable), and a raw query method. Version 1.3.4 depends on the popular 'mysql' npm package. It simplifies common database tasks while exposing underlying connection objects for advanced use. Release cadence is irregular; the package is stable but sees infrequent updates. Differentiators: built-in connection pooling (default limit 100, queue 100), easy CRUD with filters/projection, and explicit pool destruction.

npm install mysql-node-client
INSTALL
IMPORT
SIG · MYSQL-NODE-CLIENT
M
mysql-node-client
databasejavascriptv1.3.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createMysqlClient
const createMysqlClient = require('mysql-node-client')
const createMysqlClient = require('mysql-node-client').default
The library exports a function directly via module.exports, not as a default export. ESM import not documented.
mysqlClient instance
const mysqlClient = createMysqlClient(CONNECTION_DATA, options?)
const mysqlClient = new createMysqlClient(CONNECTION_DATA)
createMysqlClient is a factory function, not a constructor. Do not use 'new'.

Creates a MySQL client, lists all rows from 'test_table', logs results, and destroys the connection pool.

const createMysqlClient = require('mysql-node-client') const CONNECTION_DATA = { host: 'localhost', port: '3307', user: 'myUser', password: 'asd123', database: 'test_db' } const test = async () => { try { const mysqlClient = createMysqlClient(CONNECTION_DATA) const data = await mysqlClient.list('test_table') console.log(data.results) mysqlClient.destroyConnectionPool() } catch (err) { console.log(err) } } test()
Debug
Known issues
breakingThe 'mysql' package used as a base driver has a critical dependency on 'sqlstring' and may be deprecated. Use with care.
fix
Monitor the 'mysql' package status; consider switching to 'mysql2' and a corresponding wrapper.
affects: >=1.0.0
breakingMethods like createDatabase and listDatabases require that the connection data does NOT include a database name; otherwise they will fail.
fix
Omit database property from CONNECTION_DATA when using those DDLs.
affects: >=1.0.0
deprecatedThe 'mysql' package (v2.x) is in maintenance mode and does not support promises natively. mysql-node-client wraps it with promises but inherits its limitations (e.g., no prepared statements).
fix
Use mysql2-based wrappers for modern features.
affects: >=1.0.0
Errors
Common errors & fixes
ER_BAD_DB_ERROR: Unknown database 'test_db'
Trying to create or list databases while a database is specified in connection config.
fix
Remove 'database' from CONNECTION_DATA when calling createDatabase or listDatabases.
Cannot read property 'query' of undefined
Pool is destroyed or connection not established; possible premature destroyConnectionPool.
fix
Ensure all queries finish before calling destroyConnectionPool, or call getConnection after pool destruction.
Upgrade
Version history
1.3.4latest on npm
Audit
Dependencies
mysqlrequiredUnderlying MySQL driver; used for connection management and query execution.
Agent activity
4 hits · last 30 days
node
4
Resources
mysql-node-client — npm install mysql-node-client · libregistry