MySQL Router 8.0  /  Installing MySQL Router  /  Installing MySQL Router from Source Code

2.5 Installing MySQL Router from Source Code

The MySQL Router is written using the C++11 standard. As such, you must compile the code before you can install it. Compilation is typical of most C++ applications, as demonstrated below.

The CMake program provides control over how you configure a MySQL Router source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level MySQL Router source directory:

$> cmake . -LH
$> ccmake .

The default CMake installation prefixes are used. It is different for each platform, but for most Unix-like platforms it is "/usr/local". It is possible to alter the installation path with the CMake variable "CMAKE_INSTALL_PREFIX". For example:

$> mkdir build && cd build

Notice we use the -DINSTALL_LAYOUT=STANDALONE option to use the same installation layout as used for .tar.gz and .zip packages. This is the recommended setting for building the source.


The CMake options are not documented here, but they are similar to the MySQL Server CMake options. For additional (related) information, see MySQL Source-Configuration Options.

Download and unpack the source files, and then follow the steps specific to your platform.

Linux and macOS

$> tar xzf mysql-router-8.0.27-src.tar.gz
$> cd mysql-router-8.0.27-src

Once this is complete, you need to configure and compile MySQL Router using cmake. Our examples use the default installation location of /usr/local.


Installing MySQL Router generates a file named install_manifest.txt that lists all files (with paths) installed on the system. This file is useful for uninstalling MySQL Router.

However, there are prerequisites for compiling the MySQL Router source code.