async-mysql is a lightweight wrapper around the popular mysql npm package that enables async/await syntax for MySQL database operations. Its current stable version is 1.0.1, and it has not seen updates since 2017. The library provides a simple promise-based API, allowing developers to use ES7 async functions instead of callbacks. It is designed for Node.js environments and simplifies connection management and query execution. However, it does not support connection pooling or prepared statements directly, relying on the underlying mysql package for core functionality. The library is considered stable but feature-limited, and alternatives like mysql2 or knex offer more modern features.
npm install async-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This example shows how to connect to a MySQL database, execute a SELECT query, insert a row with parameterized queries, and fetch all users.
Migrate to mysql2 with promise API or use knex for query building.
Implement your own pool using mysql's createPool or use a different library.
Wrap queries in try/catch blocks to handle SQL errors appropriately.
Always provide an array of values for parameterized queries to prevent SQL injection.
Use const async_mysql = require('async-mysql'); (CommonJS) or if using ES modules, use a default import workaround.Provide correct host, user, password, and database in the connect configuration object.
Use Node.js 7.6+ or transpile with Babel and include the regenerator-runtime polyfill.