A MySQL connection pool wrapper with multiple pool support, async/await, connection tagging, and schema-based ORM-like query builder. Latest stable version is 2.2.14, released around 2022. It depends on the mysql package and provides features like writer/reader separation, model definitions with references (one-to-one, one-to-many), and populate queries. Key differentiators include environment-based configuration, priority/limit connection tagging, and a Schema class for defining columns with types like PK, FK, ENUM, Polygon, and DateTime. The library is TypeScript-typed and designed for Node.js, but its activity is low and may lack active maintenance.
npm install pool-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows three common usage patterns: callback query, async/await with connection.q, and custom pool creation.
Use pool.q(sql, values) or connection.q(sql, values) with await
Set required env vars or use dotenv package
Consider using mysql2 or other actively maintained drivers
Pass the options object directly, not wrapped in another object
Set a timeout or ensure connections are released promptly
Use `const pool = require('pool-mysql')` for CJSEnsure import style matches: const pool = require('pool-mysql') for CJS, or import pool from 'pool-mysql' for ESMnpm install mysql --save
Set SQL_HOST, SQL_USER, SQL_PASSWORD, SQL_TABLE in environment or use dotenv
Use pool.query(sql, values, callback) or pool.q(sql, values) for async