A lightweight wrapper around the mysql npm package that provides Promise-based async/await support for MySQL connection pools. Version 2.1.0 is the current stable release, ships TypeScript definitions, and uses environment variables for configuration via DB_HOST, DB_USER, DB_PW, and DB_NAME. It leverages the mysql.Pool.getConnection method to reuse existing connections. Compared to alternatives like mysql2/promise, this package is a simple promisification layer without advanced features like prepared statements or query streaming.
npm install mysql-promisify-poolNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows ESM import, environment variable setup with dotenv, and async query execution with error handling.
Load dotenv.config() at the very beginning of your entry file before any other imports.
Use default import as shown; stop using `new Pool()` or `Pool.query()`. Check migration guide.
Consider using `getConnection` from the pool directly if you need manual release, or switch to mysql2/promise.
Cast query result as needed: `const result = await pool.query(sql) as MyType[]`.
Use async/await or .then()/.catch() instead of callbacks.
Run `npm install mysql-promisify-pool` and ensure your package.json includes it.
Use `import pool from 'mysql-promisify-pool'` for default import.
Set DB_HOST, DB_USER, DB_PW, DB_NAME in your environment or .env file and load dotenv first.