Registry / database / pimp-my-sql

pimp-my-sql

JSON →
library0.6.3jsnpmunverified

A promise-based SQL library for Node.js, primarily aimed at MySQL use cases. Current stable version 0.6.3 wraps the mysql npm package with Bluebird promises, providing a cleaner API for query building and execution. The library supports parameterized queries, nested result sets, and transaction helpers. Release cadence is irregular; last update was several years ago. Compared to alternatives like mysql2 or knex, this package is minimal and no longer actively maintained. It offers basic query building with promise chaining but lacks TypeScript definitions and modern ESM support.

npm install pimp-my-sql
INSTALL
IMPORT
SIG · PIMP-MY-SQL
P
pimp-my-sql
databasejavascriptv0.6.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.

default
import pimpMySql from 'pimp-my-sql'
const pimpMySql = require('pimp-my-sql')
The package is ESM-only, CommonJS require will fail. Types are not included.
PimpMySql
import PimpMySql from 'pimp-my-sql'
const { PimpMySql } = require('pimp-my-sql')
Default export is a class constructor. Named import does not exist.
QueryBuilder
import pimpMySql from 'pimp-my-sql'; const qb = new pimpMySql.QueryBuilder()
import { QueryBuilder } from 'pimp-my-sql'
QueryBuilder is accessible as a static property on the default export, not a named export.

Initializes a MySQL connection using pimp-my-sql, runs a simple SELECT query with async/await, logs the result, and closes the connection.

import pimpMySql from 'pimp-my-sql'; const db = new pimpMySql({ host: 'localhost', user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'test' }); async function run() { try { const result = await db.query('SELECT 1 + 1 AS solution'); console.log('Result:', result); } catch (err) { console.error('Query failed:', err); } await db.end(); } run();
Debug
Known issues
deprecatedpimp-my-sql is unmaintained; last release in 2016. No future updates.
fix
Migrate to mysql2 or knex for modern promise support and active maintenance.
affects: *
breakingPackage uses Bluebird promises; not compatible with native Promise chaining in some edge cases (e.g., .finally()).
fix
Wrap Bluebird promises with Promise.resolve() if you need native promise methods.
affects: *
gotchaPackage only works with the 'mysql' npm package; not compatible with mysql2.
fix
Install mysql as a dependency; do not use mysql2 as it will cause runtime errors.
affects: *
deprecatedNo TypeScript definitions; all types will be 'any'.
fix
Use @types/mysql if needed, but expect limited support.
affects: *
breakingESM-only: Cannot be imported with CommonJS require(). Error: 'require() of ES Module not supported'.
fix
Use dynamic import() in CommonJS files or switch to ESM.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'pimp-my-sql'
Package not installed or not in node_modules.
fix
Run 'npm install pimp-my-sql' and ensure it is in dependencies.
TypeError: pimpMySql is not a constructor
Using CommonJS require() instead of import, or wrong default import syntax.
fix
Use ESM import syntax: 'import pimpMySql from 'pimp-my-sql''
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol
MySQL 8+ default authentication plugin is caching_sha2_password, which the mysql package may not support.
fix
Alter MySQL user to use mysql_native_password: 'ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';'
Error: Connection lost: The server closed the connection.
Idle connection timeout or server restart.
fix
Implement connection retry logic or use connection pooling with the underlying mysql package.
Upgrade
Version history
0.6.3latest on npm
Audit
Dependencies
bluebirdrequiredProvides promise implementation for the library's API.
mysqlrequiredUnderlying MySQL driver used for database connections.
Agent activity
2 hits · last 30 days
node
2
Resources
pimp-my-sql — npm install pimp-my-sql · libregistry