mariadb-connector-nodejs-install

Installs and configures the MariaDB Connector/Node.js npm package with TLS and pooling.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-nodejs-install-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-connector-nodejs-install
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/connectors/mariadb-connector-nodejs-install
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-nodejs-install-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mariadb.

What problem does it solve? Adding the MariaDB Connector/Node.js to a project involves subtle decisions that are easy to get wrong: which API entry point to import, whether native build tools are needed, how TLS verification behaves, and what pool defaults apply. This Skill prevents common misconfigurations such as adding node-gyp to Dockerfiles, installing a nonexistent @types package, or disabling certificate verification unnecessarily. ## Core Features & Use Cases - Correct installation guidance: Confirms the mariadb npm package is pure JavaScript with no native build step, requires Node.js 20 or later on the 3.5 line, and bundles its own TypeScript typings. - Entry point and API selection: Explains that the promise API is the default export, the callback API lives behind the mariadb/callback subpath, and deep lib/ imports are blocked by the exports map. - TLS and pooling configuration: Covers ssl: true verification against public CAs and MariaDB 11.4+ zero-configuration TLS, private CA and mutual TLS object forms, and pool defaults (connectionLimit 10, acquireTimeout 10000 ms, idleTimeout 1800 s). - Use Case: You are containerizing a Node.js service that talks to MariaDB. Use this Skill to write a minimal Dockerfile without build tools, connect over TLS with a private CA, and configure a connection pool with coherent timeouts. ## Quick Start Install and configure the MariaDB Connector/Node.js in my Node.js 20 project with TLS and a connection pool.

Frequently Asked Questions about mariadb-connector-nodejs-install

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I install the MariaDB Connector for Node.js?▼

Run npm install mariadb, optionally pinning a version such as npm install [email protected]. The package is pure JavaScript with no native addon, so no compiler, node-gyp, or python3 is needed on any platform including Alpine and slim Docker images.

What Node.js version does the mariadb npm package require?▼

The 3.5 line of MariaDB Connector/Node.js declares node >= 20.0.0 as a supported engine. Installing it on an older runtime is a supported-engine violation, not merely an untested combination.

Does the mariadb npm package support TypeScript?▼

Yes, TypeScript typings ship bundled with the mariadb package itself, so there is no separate @types/mariadb package to install. Both the ESM and CommonJS entry points carry their own declarations resolved through the exports map.

How do I use the callback API instead of promises with mariadb?▼

Require the mariadb/callback subpath: const mariadb = require('mariadb/callback'). The promise API is the default export at 'mariadb', and the callback API exists mainly for compatibility with older client APIs.

Why does ssl: true fail with a private CA in MariaDB Node.js connections?▼

ssl: true verifies the server certificate against the Node.js trust store, which does not include private CAs. Pass the certificate inside the ssl object instead: ssl: { ca: fs.readFileSync('ca.pem') }, where rejectUnauthorized defaults to true.

What are the default connection pool settings for mariadb createPool?▼

mariadb.createPool defaults to connectionLimit 10, acquireTimeout 10000 ms, idleTimeout 1800 seconds, and minimumIdle equal to connectionLimit. Call pool.end() on shutdown or the process will not exit cleanly.