This section covers basic installation and setup of the MySQL
both Node.js and MySQL 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).
MySQL Cluster 7.3.1 requires Node.js version 0.7.9 or earlier, due to dependency on node-waf. MySQL Cluster 7.3.2 and later use node-gyp (see https://npmjs.org/package/node-gyp), and should work with Node.js 0.8.0 and later.
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 MySQL Cluster binaries you intend to use;
using 64-bit Node.js and 32-bit MySQL Cluster. If you do not
know the architecture of your existing Node.js installation,
you can determine this by checking the value of
MySQL Cluster. If MySQL Cluster, including all header and library files, is not already installed on the system, install it (see MySQL Cluster Installation).
As mentioned previously, you must make sure that the architecture (32-bit or 64-bit) is the same for both MySQL Cluster and Node.js. You can check the architecture of an existing MySQL Cluster installation in the output of ndb_mgm -V.
mysql-js adapter also requires a
working installation of the
You can install the driver using the Node.js
npm install command; see
the project web site for the recommended version and package
Once the requirements just listed are met, you can find the files
share/nodejs in the MySQL Cluster
installation directory. (If you installed MySQL Cluster as an RPM,
/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 MySQL Cluster
You can test your installation using the supplied test program.
This requires a running MySQL 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:
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 MySQL 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.
MySQL Cluster NDB 7.3.1 also provided an alternative build script
share/node.js/setup; this was removed in
MySQL Cluster NDB 7.3.2 and later MySQL Cluster NDB 7.3 releases.