mysql-oh-wait is an async/await wrapper around mysql2 that provides a single-connection-per-process guarantee, eliminating connection management boilerplate. Current stable version is 0.19.10, released as needed. Unlike raw mysql2 or mysql, it returns query results directly without callbacks or promises, and ensures only one connection exists per process to prevent resource leaks. Requires mysql2 >= 3.0.0 and saylo >= 0.5.0 as peer dependencies. Fully written in TypeScript with bundled type definitions.
npm install mysql-oh-waitNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a simple SELECT query with parameterized WHERE clause using MysqlReq, with async/await and error handling.
Use import syntax instead of require().
Use `.query({ sql, values })` instead of `.execute(sql, values)`.Ensure all required environment variables are set before first query.
Do not close the connection manually; let the package manage it.
Update mysql2 to version 3.0.0 or higher.
Run `npm install mysql-oh-wait`.
Use `import { MysqlReq } from 'mysql-oh-wait'`.Start MySQL server and verify DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME.