This section covers basic installation and setup of the MySQL
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.
Node.js. If you do not already have Node.js installed on your system, you can obtain it from http://nodejs.org/download/. 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).
NDBuses node-gyp for compiling add-on Node.js modules; for more information about this tool, see https://npmjs.org/package/node-gyp.
Beginning with NDB 8.0.22,
NDBCLUSTERrequires Node.js version 12.18.3 or later. Beginning with NDB 8.0.33, the minimum required Node.js version is 18.12.1.
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.
node-mysql driver. The
mysql-jsadapter also requires a working installation of the
node-mysqldriver from https://github.com/felixge/node-mysql/. 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
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
directory, then use npm as shown
$> npm install .
The final period (
.) character is required.
Note that you must run this command in
share/node.js in the NDB Cluster installation
You can test your installation using the supplied test program.
This requires a running NDB Cluster, including a MySQL Server with
a database named
mysql client executable must be in the path.
To run the test suite, change to the
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
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.