Registry / database / lei-mysql

lei-mysql

JSON →
library0.1.10jsnpmunverified

Simple MySQL connection pool library for Node.js, version 0.1.10, last updated in 2014. Provides a basic pool class with configurable size. Intended as personal use and explicitly marked as unstable with breaking changes possible. No longer maintained, no TypeScript definitions, and relies on the deprecated mysql package. Not recommended for new projects; use mysql2 with pooling or better-sqlite3 for modern needs.

npm install lei-mysql
INSTALL
IMPORT
SIG · LEI-MYSQL
L
lei-mysql
databasejavascriptv0.1.10
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.

default
const MySQLPool = require('lei-mysql')
import MySQLPool from 'lei-mysql'
CommonJS only; no ES module support.
MySQLPool
const MySQLPool = require('lei-mysql').MySQLPool
const { MySQLPool } = require('lei-mysql')
The default export is the constructor itself; named export also available.
Pool
const pool = new MySQLPool(options)
const pool = MySQLPool.createPool(options)
The Pool class is used directly via constructor, not factory methods.

Shows creating a pool with an optional password environment variable, running a query, and closing the pool with destroy().

const MySQLPool = require('lei-mysql'); const pool = new MySQLPool({ host: '127.0.0.1', port: 3306, database: 'test', user: 'root', password: process.env.MYSQL_PASSWORD ?? '', pool: 10 }); pool.query('SELECT 1 + 1 AS solution', (err, results) => { if (err) throw err; console.log(results[0].solution); pool.destroy(() => { console.log('Pool closed'); }); });
Debug
Known issues
breakingNo stable API; breaking changes may occur without notice
fix
Pin to specific version (e.g., 'lei-mysql': '0.1.10') and test thoroughly.
affects: >=0.1.0
deprecatedDependency on deprecated 'mysql' package
fix
Use mysql2 or modern databases with native pooling.
affects: >=0.1.0
gotchaOptions object uses 'pool' for pool size (non-standard field name)
fix
Use property 'pool' instead of 'connectionLimit'.
affects: >=0.1.0
gotchaPool has no built-in promise support; requires callback style or promisify
fix
Wrap queries in util.promisify() or use a library with promise support.
affects: >=0.1.0
gotchadestroy method expects a callback; calling without one may cause memory leak
fix
Always provide a callback to pool.destroy() or use pool.destroy(() => {}).
affects: >=0.1.0
Errors
Common errors & fixes
Error: connect ETIMEDOUT
MySQL server not reachable or wrong host/port
fix
Verify host, port, and network connectivity; ensure MySQL is running.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Invalid username/password in pool options
fix
Check user and password fields; ensure user has remote access if needed.
TypeError: pool.query is not a function
Pool not properly initialized or wrong import
fix
Ensure pool is created with new MySQLPool(options); check options object.
Error: Pool is already destroyed
Calling query after pool.destroy()
fix
Manage pool lifecycle; do not use pool after calling destroy.
Upgrade
Version history
0.1.10latest on npm
Audit
Dependencies
mysqlrequiredPeer dependency for MySQL connection
Agent activity
8 hits · last 30 days
node
8
Resources
lei-mysql — npm install lei-mysql · libregistry