
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@purinton/mysql
Advanced tools
A simple, dependency-injectable MySQL connection pool utility for Node.js, supporting both ESM and CommonJS.

A simple, dependency-injectable MySQL connection pool utility for Node.js, supporting both ESM and CommonJS.
npm install @purinton/mysql
import { createDb } from '@purinton/mysql';
(async () => {
const db = await createDb();
// Use db.query, db.execute, etc.
await db.end();
})();
const { createDb } = require('@purinton/mysql');
(async () => {
const db = await createDb();
// Use db.query, db.execute, etc.
await db.end();
})();
Creates and returns a MySQL connection pool.
Parameters:
options.env (object, optional): Environment variables (default: process.env)options.mysqlLib (object, optional): mysql2/promise module (default: static import/require, must have createPool)options.log (object, optional): Logger instance (default: @purinton/log)Returns:
Promise<Pool>: A MySQL connection pool instanceThrows:
Environment Variables:
Required:
MYSQL_HOST - MySQL server hostMYSQL_USER - MySQL usernameMYSQL_PASSWORD - MySQL passwordMYSQL_DATABASE - MySQL database nameOptional:
MYSQL_WAIT_FOR_CONNECTIONS - true|false|1|0|yes|no|off (default: true)MYSQL_CONNECTION_LIMIT - Max connections in pool (default: 10)MYSQL_QUEUE_LIMIT - Max queued connection requests (default: 0)MYSQL_PORT - MySQL server port (default: 3306)Example:
const db = await createDb({
env: {
MYSQL_HOST: 'localhost',
MYSQL_USER: 'root',
MYSQL_PASSWORD: 'password',
MYSQL_DATABASE: 'test',
MYSQL_PORT: '3306',
MYSQL_WAIT_FOR_CONNECTIONS: 'true',
MYSQL_CONNECTION_LIMIT: '20',
MYSQL_QUEUE_LIMIT: '5',
},
mysqlLib: require('mysql2/promise'), // or import * as mysql2Promise from 'mysql2/promise' for ESM
log: console,
});
Type definitions are included:
export interface CreateDbOptions {
/** Environment variables (default: process.env) */
env?: Record<string, string>;
/** mysql2/promise module (default: static import/require, must have createPool) */
mysqlLib?: any;
/** Logger instance (default: log) */
log?: any;
}
export function createDb(options?: CreateDbOptions): Promise<any>;
For help, questions, or to chat with the author and community, visit:
FAQs
A simple, dependency-injectable MySQL connection pool utility for Node.js, supporting both ESM and CommonJS.
We found that @purinton/mysql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.