Registry / database / any-db-mysql

any-db-mysql

JSON →
library2.3.0jsnpmunverified

MySQL adapter for the Any-DB library (v2.3.0, last updated 2014). Provides a database-agnostic query interface using the mysql driver underneath. Designed for apps that want to switch between SQL backends with minimal code changes; exposes all mysql-specific methods on connections/queries. Unmaintained since 2014; use at your own risk.

npm install any-db-mysql
INSTALL
IMPORT
SIG · ANY-DB-MYSQL
A
any-db-mysql
databasejavascriptv2.3.0
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.

createConnection
import { createConnection } from 'any-db'
import { createConnection } from 'any-db-mysql'
The adapter is not meant to be imported directly; use any-db to create connections with the mysql adapter URL.
using any-db with mysql adaptor
var anyDB = require('any-db'); var conn = anyDB.createConnection('mysql://user:pass@host/db');
var conn = require('any-db-mysql').createConnection(...)
any-db-mysql is an adapter; connection URLs start with 'mysql://' and any-db loads the appropriate adapter.
Connection methods (mysql-specific)
conn.query('SELECT 1', function(err, rows) {});
conn.execute('SELECT 1', function(err, rows) {});
any-db connections support the 'query' method; the underlying mysql driver's other methods (e.g., .execute) are not part of the any-db API but may be available via inheritance.

Creates a MySQL connection via any-db, runs a simple query, and logs the result.

var anyDB = require('any-db'); var conn = anyDB.createConnection('mysql://root@localhost/test'); conn.query('SELECT 1 AS num', function(err, res) { if (err) throw err; console.log(res[0].num); }); conn.end();
Debug
Known issues
deprecatedPackage has no updates since 2014; use modern MySQL drivers like mysql2 or mariadb.
fix
Migrate to mysql2 or another actively maintained MySQL driver.
affects: >=0.0.0
gotchaThe adapter is meant to be used through any-db, not directly. Importing any-db-mysql directly may cause confusion.
fix
Use require('any-db') with a mysql:// connection URL; do not import any-db-mysql directly.
affects: >=2.0.0
breakingany-db v3 API changes broke this adapter; do not use with any-db v3+.
fix
Stick to any-db v2.1.x or upgrade to a different database abstraction library.
affects: >=2.3.0
Errors
Common errors & fixes
Error: Cannot find module 'any-db'
Missing peer dependency: any-db not installed.
fix
npm install any-db@~2.1.0
Error: Malformed URL: mysql://user@host/db
Invalid connection URL format.
fix
Use a valid URL: mysql://user:password@host:port/database
Error: getaddrinfo ENOTFOUND somehost
Cannot resolve MySQL hostname.
fix
Check network connectivity and hostname spelling.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies
any-dbrequiredpeer dependency: this package is a MySQL adapter for any-db (any-db API v2.1.x)
Agent activity
14 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources