This module provide and usefull helper to use the official mysql library.

Usage no npm install needed!

<script type="module">
  import condorLabsMysql from 'https://cdn.skypack.dev/@condor-labs/mysql';


This module provide and usefull helper to use the official mysql library.

See official documentation here.


The minimum supported version of Node.js is v8.

How to use it

To use the library you just need to follow the following steps Install the library with npm

npm install @condor-labs/mysql

Import the library:

const mysql = require('@condor-labs/mysql')(settings);

settings object properties

Property Default Description
host (String) The hostname of the database you are connecting to.
port (Number) 3306 The port number to connect to.
user (String) The MySQL user to authenticate as.
password (String) The password of that MySQL user.
Database (String) Name of the database to use for this connection (optional)



module.exports = {
    settings: {
        host: "",
        port: 3306,
        user: "user",
        password: "pass",
        database: "my_database"


const {
} = require('./constants');

try {
    (async () => {
        // init mysql connection
        const mysql = require('@condor-labs/mysql')(settings);
        // prepare query statement
        let query = `select * from information_schema.tables where (?)=(?) limit 1`;
        let params = [1, 1];
        // Execute query
        let res = await mysql.query(query, params);
        // validate response
        console.log(res && res.length > 0 ? 'MYSQL: Testing OK!!!' : 'MYSQL: Something went wrong, please check :( ');
        // close app
} catch (error) {

How to Publish

Increasing package version

You will need to update the package.json file placed in the root folder.

identify the property version and increase the right number in plus one.

Login in NPM by console.

 npm login
 [Enter username]
 [Enter password]
 [Enter email]

If all is ok the console will show you something like this : Logged in as USERNAME on https://registry.npmjs.org/.

Uploading a new version

 npm publish --access public

Ref: https://docs.npmjs.com/getting-started/publishing-npm-packages

Note: you will need to have a NPM account, if you don't have one create one here: https://www.npmjs.com/signup


The original author and current lead maintainer of this module is the @condor-labs development team.

More about Condorlabs Here.