{"id":43253,"library":"mysql-bluebird","title":"mysql-bluebird","description":"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.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","mysql","bluebird","promise"],"install":[{"cmd":"npm install mysql-bluebird","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-bluebird","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-bluebird","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The underlying MySQL driver used for database connections and queries.","package":"mysql","optional":false},{"reason":"Promise library used to promisify the MySQL driver methods.","package":"bluebird","optional":false}],"imports":[{"note":"This package does not provide an ES module; use CommonJS require or dynamic import.","wrong":"import MySQL from 'mysql-bluebird';","symbol":"MySQL (default)","correct":"const MySQL = require('mysql-bluebird');"},{"note":"Constructor must be called with new keyword.","wrong":"const db = MySQL({ host: 'localhost' });","symbol":"new MySQL(options)","correct":"const db = new MySQL({ host: 'localhost', user: 'root', password: '', database: 'test' });"},{"note":"Returns a promise; must be handled or chained.","wrong":"db.start()","symbol":"db.start()","correct":"db.start().then(() => { ... })"}],"quickstart":{"code":"const MySQL = require('mysql-bluebird');\nconst Promise = require('bluebird');\n\nconst db = new MySQL({\n  host: process.env.DB_HOST ?? 'localhost',\n  port: parseInt(process.env.DB_PORT ?? '3306'),\n  database: process.env.DB_NAME ?? 'test',\n  user: process.env.DB_USER ?? 'root',\n  password: process.env.DB_PASS ?? ''\n});\n\nPromise.resolve()\n  .then(() => db.start())\n  .then(() => db.query('SELECT 1 AS result'))\n  .then((res) => {\n    console.log(res);\n  })\n  .catch((err) => {\n    console.error('Database error:', err);\n  })\n  .finally(() => db.end());","lang":"javascript","description":"Shows how to require the module, create a connection, start, query, and handle results with promises."},"warnings":[{"fix":"Replace with mysql2/promise: npm install mysql2 and use const mysql = require('mysql2/promise');","message":"Package is abandoned and not recommended for new projects. Use mysql2/promise instead.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always chain db.start() before any db.query() calls.","message":"Must call db.start() before querying. Forgetting to start results in errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you need fields, use a raw mysql connection or access via second element in array destructuring.","message":"The query method expects standard MySQL callback signature; wrapped promise resolves with [rows, fields] but only first argument (rows) is returned.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.3':21 '2015':58 'activ':55 'base':17,35,66 'bluebird':3,6,39,78,82 'callback':34 'callback-bas':33 'databas':18 'develop':56 'driver':13 'end':47 'javascript':80 'latest':24 'legaci':74 'librari':30,68 'lightweight':5 'like':43 'method':42 'minim':51 'modern':63 'mysql':2,11,36,67,81 'mysql-bluebird':1 'mysql2/promise':71 'node.js':12 'offer':41 'oper':19 'packag':37 'project':75 'promis':7,16,40,65,79,83 'promise-bas':15,64 'provid':14 'queri':45 'releas':28 'reli':76 'sinc':57 'stabl':27 'start':44 'suitabl':72 'supersed':61 'version':20 'wrap':31 'wrapper':8,52","created_at":"2026-06-05T16:58:55.198013+00:00","updated_at":"2026-06-05T16:58:55.198013+00:00","problems":[{"fix":"Run 'npm install mysql-bluebird' and ensure require path is correct.","cause":"Package not installed or typo in require path.","error":"Error: Cannot find module 'mysql-bluebird'"},{"fix":"Use 'new MySQL(options)' instead of just 'MySQL(options)'.","cause":"Forgetting new keyword when instantiating MySQL object.","error":"TypeError: Class constructor MySQL cannot be invoked without 'new'"},{"fix":"Chain queries after db.start() using .then() or async/await.","cause":"Calling db.query() before db.start() has resolved.","error":"Error: Cannot call query before start()"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mysql-bluebird","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}