Registry / database / query-mysql

query-mysql

JSON →
library0.0.2jsnpmunverified

query-mysql is a lightweight Node.js library for managing MySQL queries, version 0.0.2. It provides a simple promise-based interface for common database operations such as select, insert, update, and delete. The library wraps the mysql npm package and offers a chainable query builder to simplify SQL generation. However, it is in very early development (pre-1.0) with minimal documentation, no test coverage, and appears to be unmaintained, last updated in 2020. Alternatives like knex.js or mysql2 provide more robust features, better performance, and active community support.

npm install query-mysql
INSTALL
IMPORT
SIG · QUERY-MYSQL
Q
query-mysql
databasejavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QueryMysql
import QueryMysql from 'query-mysql'
const QueryMysql = require('query-mysql').default
Default export only; no named exports available in this version
mysql
import mysql from 'mysql'
const mysql = require('mysql').default
The underlying mysql package is a peer dependency, not imported from query-mysql

Initializes a connection to MySQL, performs a simple select query using the chainable builder, and closes the connection.

import QueryMysql from 'query-mysql'; const db = new QueryMysql({ host: process.env.DB_HOST ?? 'localhost', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'test' }); async function main() { try { const rows = await db.select('*').from('users').where({ id: 1 }).execute(); console.log(rows); } catch (err) { console.error(err); } finally { db.close(); } } main();
Debug
Known issues
deprecatedPackage is unmaintained and has not been updated since 2020.
fix
Consider migrating to knex.js or mysql2 for active support.
affects: 0.0.2
gotchaConnection pooling is not implemented; each QueryMysql instance uses a single connection.
fix
Use a connection pool from the mysql package directly if needed.
affects: <=0.0.2
gotchaSQL injection possible if user input is passed unsanitized to the where clause.
fix
Always use parameterized queries via the where object syntax.
affects: <=0.0.2
breakingThe execute method returns results in an inconsistent format (array vs object) depending on query type.
fix
Check the query type to determine expected result shape.
affects: 0.0.2
Errors
Common errors & fixes
Cannot find module 'query-mysql'
Package not installed or version mismatch.
fix
Run 'npm install query-mysql' and ensure package.json includes dependency.
TypeError: db.select is not a function
QueryMysql instance not initialized correctly.
fix
Use 'new QueryMysql({...})' and call methods on the instance, not the class.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
mysqlrequiredCore dependency for MySQL database connectivity
Agent activity
12 hits · last 30 days
node
10
Meta
1
Resources
query-mysql — npm install query-mysql · libregistry