Registry / database / mysql-pool

mysql-pool

JSON →
library0.2.2jsnpmunverified

A lightweight MySQL connection pool for Node.js built on top of node-mysql. Version 0.2.2 is the latest stable release, with no newer versions since 2012. Provides basic pooling functionality (create pool, get connection, release) but is unmaintained and lacks modern features like promise support, TypeScript types, or connection limit options. Alternatives like mysql2 or generic-pool are recommended.

npm install mysql-pool
INSTALL
IMPORT
SIG · MYSQL-POOL
M
mysql-pool
databasejavascriptv0.2.2
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.

createPool
const { createPool } = require('mysql-pool');
import { createPool } from 'mysql-pool';
ES module import is not supported; only CommonJS require works.
Pool
const Pool = require('mysql-pool').Pool;
const Pool = require('mysql-pool');
Pool is a named export, not the default export.
default
const mysqlPool = require('mysql-pool'); // no default export
import mysqlPool from 'mysql-pool';
No default export; must destructure named exports.

Creates a connection pool, acquires a connection, runs a query, and releases the connection. Note the mandatory 'mysql' option.

const mysql = require('mysql'); const { createPool } = require('mysql-pool'); const pool = createPool({ mysql: mysql, host: 'localhost', user: 'root', password: process.env.PASSWORD ?? '' }); pool.getConnection((err, conn) => { if (err) throw err; conn.query('SELECT 1 + 1 AS solution', (err, results) => { if (err) throw err; console.log(results[0].solution); conn.release(); }); });
Debug
Known issues
deprecatedPackage has not been updated since 2012 and is effectively unmaintained.
fix
Migrate to a modern pool like mysql2's built-in promise pool.
affects: >=0.0.1
gotchaThe 'mysql' option is required but not documented as mandatory in older versions.
fix
Always pass the mysql module explicitly: { mysql: require('mysql') }.
affects: >=0.0.1 <0.3.0
gotchaThe pool does not support promise/async-await. All callbacks are error-first.
fix
Wrap in a promise manually or use a library that supports promises.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'mysql-pool'
Package not installed or misplaced import path.
fix
npm install mysql-pool, then require using correct path.
pool.getConnection is not a function
Incorrect import: got a wrong export instead of the Pool instance.
fix
Use const { createPool } = require('mysql-pool'); then invoke createPool().
TypeError: Cannot read property 'query' of undefined
Connection not acquired correctly or callback not invoked.
fix
Ensure getConnection callback receives (err, conn) and conn is used inside callback.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
mysqlrequiredCore MySQL driver that mysql-pool wraps; must be installed separately as a peer dependency.
Agent activity
2 hits · last 30 days
node
2
Resources
mysql-pool — npm install mysql-pool · libregistry