Registry / database / mysql-libmysqlclient

mysql-libmysqlclient

JSON →
library1.6.0jsnpmunverified

Asynchronous MySQL bindings for Node.js using libmysqlclient C library. Version 1.6.0 is the latest. Provides all general connection/query functions from MySQL C API with partial prepared statement support. Connect, query, and fetchAll are async. Requires libmysqlclient-dev system package to build. Notable for using raw libmysqlclient rather than pure JavaScript implementation; performance-focused with async querySend. Maintained since 2010 with over 10 contributors.

npm install mysql-libmysqlclient
INSTALL
IMPORT
SIG · MYSQL-LIBMYSQLCLIE
M
mysql-libmysqlclient
databasejavascriptv1.6.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.

default
const mysql = require('mysql-libmysqlclient');
import mysql from 'mysql-libmysqlclient'; // ESM import not supported; only CommonJS
Module is CommonJS-only; must use require(). No default export.
createConnection
const mysql = require('mysql-libmysqlclient'); const conn = mysql.createConnection();
const { createConnection } = require('mysql-libmysqlclient'); // destructuring works but createConnection is a method on the default export? Actually it is a named export. Check docs
createConnection is available as a named export. Both patterns are correct.
MysqlConnection
const mysql = require('mysql-libmysqlclient'); const conn = new mysql.MysqlConnection();
const { MysqlConnection } = require('mysql-libmysqlclient'); // not available as named export? It might be. Verify documentation
MysqlConnection is the constructor for connection objects. Typically used via createConnection factory.

Demonstrates connecting to MySQL and executing a simple async SELECT query.

const mysql = require('mysql-libmysqlclient'); const conn = mysql.createConnection(); conn.connect('host', 'user', 'password', 'database', (err) => { if (err) throw err; conn.query('SELECT 1 + 1 AS solution', (err, rows) => { if (err) throw err; console.log('Solution:', rows[0].solution); conn.close(); }); });
Debug
Known issues
breakingRequires libmysqlclient-dev system package to build; npm install will fail without it.
fix
Install libmysqlclient-dev via apt-get (Debian) or yum install mysql-devel (CentOS).
affects: >=0.0.0
deprecatedOnly tested with Node.js 0.8-0.11; not updated for modern Node.js versions (4.x+).
fix
Use a maintained MySQL driver like mysql2 or mysql instead.
affects: >=0.0.0
gotchaConnection methods like connect, query are callback-based; no Promise support.
fix
Use promisify from util to wrap async calls.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mysql-libmysqlclient'
Module not installed or npm install failure due to missing system dependencies.
fix
Install libmysqlclient-dev first, then npm install mysql-libmysqlclient.
ERR_MODULE_NOT_FOUND
Trying to import via ES modules; module is CommonJS-only.
fix
Use require() instead of import.
Upgrade
Version history
1.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

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