Registry / database / mbr-mysql

mbr-mysql

JSON →
library1.1.1jsnpmunverified

A minimalistic MySQL client for Node.js that provides a callback-based API for connecting, querying, preparing statements, and executing prepared statements. This package is at version 1.1.1 and appears to be in early development with sparse documentation and no clear release cadence. It differentiates itself from mainstream clients like mysql2 or mysql by offering a very low-level, custom protocol implementation with control over max packet size and separate callback handlers for success and error on every operation. Notable: debug logging of raw sent/received data, idle connection timeout, and prepared statement support with long data sending. However, it lacks modern Promise/async-await support and TypeScript types, and the API pattern is unusual (callbacks on connection options).

npm install mbr-mysql
INSTALL
IMPORT
SIG · MBR-MYSQL
M
mbr-mysql
databasejavascriptv1.1.1
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.

MySQL
const { MySQL } = require('mbr-mysql')
const MySQL = require('mbr-mysql')
The package exports an object with MySQL property, not the constructor directly. Not ESM compatible.
MySQL (ESM)
import { MySQL } from 'mbr-mysql'
import MySQL from 'mbr-mysql'
ESM import works if using TypeScript with esModuleInterop or Node with --experimental-modules, but the package is CJS internally.
Connection
const connection = mysql.connect({...})
const connection = new mysql.Connection(...)
Connection objects are created by calling mysql.connect() with callbacks; there is no exported Connection class.

Initializes a MySQL client, connects to a database, runs a simple query, and closes the connection using callbacks.

const { MySQL } = require('mbr-mysql'); const mysql = new MySQL({ host: 'localhost', port: 3306, debug: false, timeout: 0 }); const connection = mysql.connect({ user: 'root', password: process.env.MYSQL_PASSWORD ?? '', base: 'test', onSuccess: () => console.log('Connected'), onError: (err) => console.error('Connection error:', err) }); connection.query( 'SELECT 1 + 1 AS result', { onSuccess: (rows) => console.log('Query result:', rows), onError: (err) => console.error('Query error:', err) } ); connection.close({ onSuccess: () => console.log('Closed'), onError: (err) => console.error('Close error:', err) });
Debug
Known issues
gotchaThe package uses callback-based APIs with no Promise support. All operations require onSuccess/onError handlers passed in the options object.
fix
Wrap operations in Promises manually or use a library like 'util.promisify'.
affects: >=1.0.0
gotchaThe `password` property in connect options is named `pass`, not `password`.
fix
Use `pass` instead of `password` in the connection options object.
affects: >=1.0.0
gotchaThe package has very limited error handling; errors from the callback may not be captured if no onError handler is provided.
fix
Always provide an onError callback to every operation.
affects: >=1.0.0
gotchaThe library appears to implement a raw MySQL protocol parser and may not support all MySQL features (e.g., prepared statements with output parameters, multiple result sets, transactions).
fix
Consider using a mature client like mysql2 for production use.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: MySQL is not a constructor
Importing the default export instead of destructuring { MySQL } from the package.
fix
const { MySQL } = require('mbr-mysql'); (CommonJS) or import { MySQL } from 'mbr-mysql'; (ESM)
Cannot read property 'query' of undefined
Trying to call connection.query before the connection is established (onSuccess callback not fired yet).
fix
Wrap the query call inside the onSuccess callback of mysql.connect().
Error: Unknown authentication method 'caching_sha2_password'
MySQL 8+ uses caching_sha2_password by default, which this client may not support fully.
fix
Configure MySQL user to use mysql_native_password, or use a more modern client.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
mbr-mysql — npm install mbr-mysql · libregistry