mm_mysql is a Node.js MySQL library that wraps the mysql2 driver with a clean async/await API, automatic type inference for table creation, built-in connection pooling, and transaction support. Current version is 2.4.6, released with a focus on ease of use. Key differentiators: auto-creates tables from JavaScript object definitions (infers INT, VARCHAR, TEXT, DATETIME, etc.), provides a high-level DB manager with CRUD methods (add, get, set, del), and supports both callback-style transactions and awaitable `beginTransaction`/`commit`/`rollback`. It uses mysql2 under the hood, supports connection pooling, health checks, and debugging mode. Requires Node >=12.0.0.
npm install mm_mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Mysql instance, opening a connection, using DB manager to auto-create a table, inserting a row, and querying all rows.
Always call await mysql.open() before using mysql.db() or other methods.
const db = mysql.db().new('users', 'id');Ensure mysql2 is installed: npm install mm_mysql mysql2
Replace mysql.init() with await mysql.open();
Inside the callback, always call either await tx.commit() or await tx.rollback() before returning.
Use destructured import: const { Mysql } = require('mm_mysql');Always call await mysql.open() before using mysql.db() or any SQL methods.
Ensure mysql.open() is called and awaited before calling mysql.db().
Check if connection is already open; avoid multiple open() calls. Use a singleton pattern or close before reopening.