Registry / database / ali-h-mysql

ali-h-mysql

JSON →
library1.1.6jsnpmunverified

A lightweight Node.js MySQL client that provides a fluent API for building queries, inserts, updates, and deletes. Version 1.1.6 is the latest stable release; maintenance appears irregular. It supports chaining select/where/join/groupby/orderby, paging, literal expressions, and batch operations. Differs from knex/mysql2 by offering a simpler, more concise syntax with fewer dependencies, but it is not widely adopted and has limited community support.

npm install ali-h-mysql
INSTALL
IMPORT
SIG · ALI-H-MYSQL
A
ali-h-mysql
databasejavascriptv1.1.6
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.

DbClient
const DbClient = require('ali-mysql-client')
import DbClient from 'ali-mysql-client'
The package does not ship ESM; use CommonJS require. Type definitions are not included.

Initializes a DbClient with MySQL credentials and runs a count query with a LIKE condition.

const DbClient = require('ali-mysql-client'); const db = new DbClient({ host: '127.0.0.1', user: 'root', password: 'secret', database: 'my_db' }); async function run() { const count = await db .select('count(1)') .from('page') .where('name', 'test', 'like') .queryValue(); console.log(count); } run();
Debug
Known issues
gotchaPackage name on npm is ali-mysql-client but the repository is ali-h-mysql. Ensure you install 'ali-mysql-client'.
fix
npm install ali-mysql-client
affects: all
deprecatedThe package depends on the deprecated 'mysql' npm package. No migration to 'mysql2' is provided.
fix
Consider using mysql2 or native ESM alternatives like knex.
affects: *
gotchaThe query methods .queryValue(), .queryRow(), .queryList(), .queryListWithPaging() are not chainable after .toSql(); you must choose one.
fix
Do not call .toSql() and a query method together.
affects: *
gotchaLiteral values like db.literals.now are used without parentheses; direct string interpolation is also supported but may be insecure.
fix
Use db.literal('NOW()') explicitly for clarity.
affects: *
Errors
Common errors & fixes
Cannot find module 'ali-mysql-client'
Package not installed or typo in package name (ali-h-mysql vs ali-mysql-client).
fix
Install the correct package: npm install ali-mysql-client
TypeError: db.select(...).from(...).where(...).queryList is not a function
Chained query method after .toSql() which returns a string, not the query builder.
fix
Do not call .toSql() before the query execution method.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Invalid MySQL credentials or host/permissions.
fix
Verify host, user, password, and database in DbClient config.
Upgrade
Version history
1.1.6latest on npm
Audit
Dependencies
mysqlrequiredUnderlying MySQL driver for database connections
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
2
Resources
ali-h-mysql — npm install ali-h-mysql · libregistry