Registry / database / mysql-bluebird

mysql-bluebird

JSON →
library0.0.3jsnpmunverified

A lightweight Bluebird promise wrapper for the MySQL Node.js driver providing promise-based database operations. Version 0.0.3 is the latest and only stable release. The library wraps the callback-based mysql package with Bluebird promises, offering methods like start(), query(), and end(). It is a minimal wrapper with no active development since 2015, and is superseded by modern promise-based MySQL libraries such as mysql2/promise. Suitable for legacy projects relying on Bluebird promises.

npm install mysql-bluebird
INSTALL
IMPORT
SIG · MYSQL-BLUEBIRD
M
mysql-bluebird
databasejavascriptv0.0.3
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.

MySQL (default)
✓ const MySQL = require('mysql-bluebird');
✗ import MySQL from 'mysql-bluebird';
This package does not provide an ES module; use CommonJS require or dynamic import.
new MySQL(options)
✓ const db = new MySQL({ host: 'localhost', user: 'root', password: '', database: 'test' });
✗ const db = MySQL({ host: 'localhost' });
Constructor must be called with new keyword.
db.start()
✓ db.start().then(() => { ... })
✗ db.start()
Returns a promise; must be handled or chained.

Shows how to require the module, create a connection, start, query, and handle results with promises.

const MySQL = require('mysql-bluebird'); const Promise = require('bluebird'); const db = new MySQL({ host: process.env.DB_HOST ?? 'localhost', port: parseInt(process.env.DB_PORT ?? '3306'), database: process.env.DB_NAME ?? 'test', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '' }); Promise.resolve() .then(() => db.start()) .then(() => db.query('SELECT 1 AS result')) .then((res) => { console.log(res); }) .catch((err) => { console.error('Database error:', err); }) .finally(() => db.end());
Debug
Known issues
deprecatedPackage is abandoned and not recommended for new projects. Use mysql2/promise instead.
fix
Replace with mysql2/promise: npm install mysql2 and use const mysql = require('mysql2/promise');
affects: >=0.0.0
gotchaMust call db.start() before querying. Forgetting to start results in errors.
fix
Always chain db.start() before any db.query() calls.
affects: >=0.0.0
gotchaThe query method expects standard MySQL callback signature; wrapped promise resolves with [rows, fields] but only first argument (rows) is returned.
fix
If you need fields, use a raw mysql connection or access via second element in array destructuring.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mysql-bluebird'
Package not installed or typo in require path.
fix
Run 'npm install mysql-bluebird' and ensure require path is correct.
TypeError: Class constructor MySQL cannot be invoked without 'new'
Forgetting new keyword when instantiating MySQL object.
fix
Use 'new MySQL(options)' instead of just 'MySQL(options)'.
Error: Cannot call query before start()
Calling db.query() before db.start() has resolved.
fix
Chain queries after db.start() using .then() or async/await.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
mysqlrequiredThe underlying MySQL driver used for database connections and queries.
bluebirdrequiredPromise library used to promisify the MySQL driver methods.
Agent activity
7 hits · last 30 days
node
6
Resources
mysql-bluebird — npm install mysql-bluebird · libregistry