{"id":43248,"library":"mysql-as-promised","title":"mysql-as-promised","description":"mysql-as-promised is a lightweight wrapper around the popular mysql npm package that returns promises instead of using callbacks, enabling async/await syntax. Version 0.2.2 is the latest stable release; development appears to have stopped and the API is incomplete. It differentiates by avoiding external promise libraries (using native ES6 promises) and preserving the original mysql API shape, but only covers a subset of mysql operations.","status":"abandoned","version":"0.2.2","language":"javascript","source_language":"en","source_url":"git://github.com/object-layer/mysql-as-promised","tags":["javascript"],"install":[{"cmd":"npm install mysql-as-promised","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-as-promised","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-as-promised","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the wrapper requires the mysql package to function.","package":"mysql","optional":false}],"imports":[{"note":"Package does not assign to module.exports; default import is the only correct ESM pattern. CommonJS require may work but is not officially supported.","wrong":"const mysql = require('mysql-as-promised')","symbol":"default","correct":"import mysql from 'mysql-as-promised'"},{"note":"Named export available; avoid mixing default and named exports with CommonJS.","wrong":"const mysql = require('mysql-as-promised'); mysql.createPool","symbol":"createPool","correct":"import { createPool } from 'mysql-as-promised'"},{"note":"Named export for direct connections.","wrong":null,"symbol":"createConnection","correct":"import { createConnection } from 'mysql-as-promised'"}],"quickstart":{"code":"import mysql from 'mysql-as-promised';\n\nasync function main() {\n  const pool = mysql.createPool('mysql://test@localhost/test');\n  const connection = await pool.getConnection();\n  const rows = await connection.query('SELECT ? + ? AS solution', [2, 3]);\n  console.log(rows[0].solution); // => 5\n  connection.release();\n  await pool.end();\n}\n\nmain().catch(console.error);","lang":"javascript","description":"Creates a connection pool, queries using async/await, and releases resources."},"warnings":[{"fix":"Consider using mysql2/promise or knex for production.","message":"The package appears to be unmaintained (last commit years ago). Do not use in new projects.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Check source or test coverage before adopting.","message":"Only a subset of mysql API is implemented; missing features like multiple statements, streaming, etc.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use Node >= 4 or provide a polyfill.","message":"Package uses native Promise (ES6). Node.js versions < 0.12 may not have native Promise support.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.2.2':30 'api':43,62 'appear':37 'around':13 'async/await':27 'avoid':49 'callback':25 'cover':66 'develop':36 'differenti':47 'enabl':26 'es6':55 'extern':50 'incomplet':45 'instead':22 'javascript':72 'latest':33 'librari':52 'lightweight':11 'mysql':2,6,16,61,70 'mysql-as-promis':1,5 'nativ':54 'npm':17 'oper':71 'origin':60 'packag':18 'popular':15 'preserv':58 'promis':4,8,21,51,56 'releas':35 'return':20 'shape':63 'stabl':34 'stop':40 'subset':68 'syntax':28 'use':24,53 'version':29 'wrapper':12","created_at":"2026-06-05T16:58:53.608680+00:00","updated_at":"2026-06-05T16:58:53.608680+00:00","problems":[{"fix":"npm install mysql","cause":"mysql is a peer dependency and not installed automatically.","error":"Cannot find module 'mysql'"},{"fix":"Use default import: import mysql from 'mysql-as-promised'","cause":"Improper import: using default import when function is not exported.","error":"TypeError: mysql.createPool is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/object-layer/mysql-as-promised#readme","github":"git://github.com/object-layer/mysql-as-promised","docs":null,"changelog":null,"pypi":null,"npm":"mysql-as-promised","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}