MySQL NDB Cluster API Developer Guide  /  MySQL NoSQL Connector for JavaScript  /  Installing the JavaScript Connector

5.2 Installing the JavaScript Connector

This section covers basic installation and setup of the MySQL JavaScript Connector and its prerequites. The Connector requires both Node.js and NDB Cluster to be installed first; you can install these in either order. In addition, the mysql-js adapter requires the node-mysql driver. Building the Connector also requires that your system have a working C++ compiler such as gcc or Microsoft Visual Studio.

To install all of the prerequisites for the JavaScript Connector, including node-mysql, you should perform the following steps:

  1. Node.js.  If you do not already have Node.js installed on your system, you can obtain it from In addition to source code, prebuilt binaries and installers are available for a number of platforms. Many Linux distributions also have Node.js in their repositories (you may need to add an alternative repository in your package manager).

    NDB uses node-gyp for compiling add-on Node.js modules; for more information about this tool, see

    Beginning with NDB 8.0.22, NDBCLUSTER requires Node.js version 12.18.3 or later. Beginning with NDB 8.0.33, the minimum required Node.js version is 18.12.1.

    Regardless of the method by which you obtain Node.js, keep in mind that the architecture of the version you install must match that of the NDB Cluster binaries you intend to use; you cannot, for example, install the JavaScript Connector using 64-bit Node.js and 32-bit NDB Cluster. If you do not know the architecture of your existing Node.js installation, you can determine this by checking the value of global.process.arch.

  2. NDB Cluster.  If NDB Cluster, including all header and library files, is not already installed on the system, install it (see NDB Cluster Installation).

    As mentioned previously, you must make sure that the architecture (32-bit or 64-bit) is the same for both NDB Cluster and Node.js. You can check the architecture of an existing NDB Cluster installation in the output of ndb_mgm -V.

  3. node-mysql driver.  The mysql-js adapter also requires a working installation of the node-mysql driver from You can install the driver using the Node.js npm install command; see the project website for the recommended version and package identifier.

Once the requirements just listed are met, you can find the files needed to install the MySQL Connector for JavaScript in share/nodejs in the NDB Cluster installation directory. (If you installed NDB Cluster as an RPM, this is /usr/share/mysql/nodejs.) To use the Node.js npm tool to perform a best-guess installation without any user intervention, change to the share/nodejs directory, then use npm as shown here:

$> npm install .

The final period (.) character is required. Note that you must run this command in share/node.js in the NDB Cluster installation directory.

You can test your installation using the supplied test program. This requires a running NDB Cluster, including a MySQL Server with a database named test. The mysql client executable must be in the path.

To run the test suite, change to the test directory, then execute command shown here:

$> node driver

By default, all servers are run on the local machine using default ports; this can be changed by editing the file test/test_connection.js, which is generated by running the test suite. If this file is not already present (see Bug #16967624), you can copy share/nodejs/test/lib/test_connection_js to the test directory for this purpose.

If you istalled NDB Cluster to a nondefault location, you may need to export the LD_LIBRARY_PATH to enable the test suite. The test suite also requires that the test database be available on the MySQL server.