Registry / database / ctl-mysql

ctl-mysql

JSON →
library1.1.6jsnpmunverified

Lightweight MySQL wrapper for Node.js that integrates with the CTL async flow control library (ctl >=1.0.0). Version 1.1.6 is current. Provides promise-based query execution and connection pooling. Differentiators: tight integration with CTL for structured error handling and composable async operations. Released by leanderlee.

npm install ctl-mysql
INSTALL
IMPORT
SIG · CTL-MYSQL
C
ctl-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.

default
✓ import ctlMysql from 'ctl-mysql'
✗ const ctlMysql = require('ctl-mysql')
Package supports ESM import; CommonJS require may work but is not guaranteed.
connect
✓ import { connect } from 'ctl-mysql'
✗ import { Connect } from 'ctl-mysql'
Named export 'connect' is a factory function; case-sensitive.
query
✓ import { query } from 'ctl-mysql'
After connecting, use the returned object to execute queries.

Connects to a MySQL database using CTL MySQL wrapper, executes a simple query, and logs results.

import { connect } from 'ctl-mysql'; import ctl from 'ctl'; const db = connect({ host: 'localhost', user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'test' }); async function run() { const rows = await db.query('SELECT 1 + 1 AS solution'); console.log(rows); } ctl(run, { error: (err) => console.error(err) });
Debug
Known issues
gotchaPollution vulnerability in mysql package used as dependency (CVE-2019-11358) - affects versions before 2.18.1.
fix
Update to version 1.1.6 or later, which uses mysql >=2.18.1.
affects: <1.1.6
gotchaCTL peer dependency version constraint (>1.0.0) may cause compatibility issues with earlier or later versions.
fix
Ensure ctl version matches '>=1.0.0'.
affects: >=1.1.6
Errors
Common errors & fixes
Error: Cannot find module 'ctl-mysql'
Missing peer dependency or incorrect installation.
fix
Run 'npm install ctl-mysql ctl' to install both the wrapper and its peer dependency.
TypeError: db.query is not a function
Using require or wrong import style, or not calling connect() first.
fix
Use ESM import: import { connect } from 'ctl-mysql'; const db = connect({...}); await db.query(...);
Access denied for user 'root'@'localhost'
Incorrect database credentials or missing password.
fix
Check host, user, password, and database name in connect options.
Upgrade
Version history
1.1.6latest on npm
Audit
Dependencies
ctlrequiredPeer dependency required for flow control integration
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
ctl-mysql — npm install ctl-mysql · libregistry