Registry / database / mariasql

mariasql

JSON →
library0.2.6jsnpmunverified

A Node.js binding to MariaDB's non-blocking (MySQL-compatible) client library. Version 0.2.6 is the current stable release, targeting Node.js >=0.10.0. Unlike traditional libmysqlclient bindings, it uses MariaDB's non-blocking functions to achieve asynchronous behavior without multiple threads. It supports prepared statements, streaming rows via streams2, and metadata retrieval. This library is distinct from other MySQL drivers (e.g., mysql, mysql2) in that it specifically leverages MariaDB's client library for non-blocking I/O. However, note that it is no longer actively maintained; users are advised to consider alternatives like mysql2 or mariadb.

npm install mariasql
INSTALL
IMPORT
SIG · MARIASQL
M
mariasql
databasejavascriptv0.2.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.

Client
var Client = require('mariasql');
import Client from 'mariasql';
CJS only; no ESM support.
Client
var Client = require('mariasql'); var c = new Client({...});
var c = new require('mariasql')({...});
Client is a constructor, must be called with new.
Client query
c.query('SELECT 1', function(err, rows) { ... });
c.query('SELECT 1', function(rows) { ... });
Callback receives (err, rows) — first argument is error.

Connects to MariaDB, executes a parameterized query with positional placeholders, and logs results.

var Client = require('mariasql'); var c = new Client({ host: '127.0.0.1', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', db: 'test' }); c.query('SELECT * FROM users WHERE id = ?', [1], function(err, rows) { if (err) throw err; console.log(rows); }); c.end();
Debug
Known issues
breakingUpgrade from v0.1.x to v0.2.x includes breaking API changes.
fix
Review breaking changes at https://github.com/mscdex/node-mariasql/wiki/Upgrading-v0.1.x-to-v0.2.x
affects: >=0.2.0
deprecatedLibrary is no longer actively maintained. No new releases since 2016.
fix
Consider migrating to 'mysql2' or 'mariadb' packages.
affects: >=0.0.0
gotchaClient must be instantiated with `new`; omitting `new` causes silent failure.
fix
Always use `new Client({...})`.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mariasql'
Native addon not compiled or missing dependencies (e.g., cmake, MariaDB client library).
fix
Install build tools: `npm install -g node-gyp` and ensure libmariadb-dev is installed (e.g., `apt-get install libmariadb-dev`).
Error: Client is not a constructor
Using `require('mariasql')()` or forgetting `new`.
fix
Use: `var Client = require('mariasql'); var c = new Client({...});`
TypeError: c.query(...).on is not a function
Trying to use streaming API on a query without returning the Query object.
fix
Streaming requires assigning the query to a variable: `var query = c.query(...); query.on('result', ...);`
Upgrade
Version history
0.2.6latest on npm
Audit
Dependencies
lzma-nativeoptionalUsed internally for compression support (optional at runtime).
Agent activity
13 hits · last 30 days
node
12
Resources
mariasql — npm install mariasql · libregistry