A MySQL database wrapper for Node.js providing async/await promises, TypeScript definitions, and helper methods for insert/update and named parameters. Current stable version is 0.3.16, last updated with Node.js 11.x support. It wraps the mysql npm package and adds a promise-based interface, automatic idle connection closing, and a query formatter that supports both positional (?) and named (:name) parameters. Unlike more modern libraries (e.g., mysql2, knex), it requires manual configuration via a config.json file and is not actively maintained. It is suitable for simple use cases but lacks connection pooling with advanced features, and the API is somewhat unconventional (e.g., accessing results via getters like db.rows).
npm install phanx-mysqlVerified import paths — ran on the pinned version, not inferred.
Shows how to import, configure, create a connection, run a query, and close the connection using async/await.
Use 'new PhanxMysql()' and then 'await db.start()' or 'await PhanxMysql.createAndStart()'.
Consider migrating to mysql2 or knex for better maintenance and features.
Create a config.json file in your project root with properties like host, user, password, database.
Use async/await or .then() for promise-based control flow.
Set PhanxMysql.config immediately after import, before any async calls.
Create a config.json with database connection info in your project root.
Ensure you await db.start() or await PhanxMysql.createAndStart() before calling query.