MySQL Router 8.0  /  Installing MySQL Router  /  Installing MySQL Router on Linux

2.1 Installing MySQL Router on Linux

There are binary distributions of MySQL Router available for several variants of Linux, including Fedora, Oracle Linux, Red Hat, and Ubuntu.

Installation options include:

  • Official MySQL Yum or APT repository packages: These binaries are built by the MySQL Release team. For additional information about installing these, see the quick guides for installing them using Yum or APT.

  • Download official MySQL packages: Downloads are available at https://dev.mysql.com/downloads/router. Download and install using your preferred package manager.

    Alternatively, MySQL Router is included in MySQL Server's source and monolithic binary packages as of MySQL Router 8.0.13.

  • Download the source code and compile yourself: The source code is available as part of MySQL Server at https://dev.mysql.com/downloads/mysql. Alternatively, the source code is also available on GitHub (specifically in the router directory).

    For information about compiling MySQL Router, see Installing MySQL Router from Source Code.

The procedure for installing on Linux depends on your Linux distribution.

Installing MySQL Router using an official DEB or RPM package creates a local system user and group named "mysqlrouter" on the host that MySQL Router runs as by default. For additional information, see the system user's configuration option.

Installing DEB packages

On Ubuntu, and other systems that use the Debian package scheme, you can either download and install .deb packages or use the APT package manager.

Using the APT Package Manager

  1. Install the MySQL APT repository as described in the MySQL APT Repository documentation. For example:

    Note

    Download the APT configuration package from here.

    $> sudo dpkg -i mysql-apt-config_0.8.30-1_all.deb

    Choose the desired MySQL Server series to install, such as MySQL Server 8.0. This choice also determines the MySQL Router version that is installed from the MySQL repository.

  2. Update your APT repository:

    $> sudo apt-get update
  3. Install MySQL Router. For example:

    $> sudo apt-get install mysql-router-community

Manually Installing a Package

You can also download the .deb package and install it from the command line similarly to

$> sudo dpkg -i package.deb

package.deb is the MySQL Router package name; for example, mysql-router-community-version-1ubuntu24.04_amd64.deb, where version is the MySQL Router version number.

Installing RPM packages

On RPM-based systems, you can either download and install RPM packages or use the Yum package manager.

Using the Yum Package Manager

  • First, install the MySQL Yum repository as described in the MySQL Yum Repository documentation. For example:

    Note

    Download the Yum configuration package from here.

    $> sudo rpm -Uvh mysql84-community-release-el7-1.noarch.rpm
  • Next, optionally change the active MySQL Server version, which defaults to MySQL 8.4 LTS. For example, to change version 8.4 to 8.0 for both the MySQL Server (mysql) and MySQL Router (part of mysql-tools) subrepositories:

    $> sudo yum-config-manager --disable mysql-8.4-lts-community
    $> sudo yum-config-manager --enable  mysql80-community
    
    $> sudo yum-config-manager --disable mysql-tools-8.4-lts-community
    $> sudo yum-config-manager --enable  mysql-tools-community
  • Next, install MySQL Router. For example:

    $> sudo yum install mysql-router-community

Manually Installing an RPM Package

$> sudo rpm -i package.rpm

package.rpm is the MySQL Router package name; for example, mysql-router-community-version-el7.x86_64.rpm, where version is the MySQL Router version number.

Uninstalling

The procedure for uninstalling MySQL Router on Linux depends on the package you are using.

Uninstalling DEB packages

To uninstall a Debian package, use this command:

$> sudo dpkg -r mysql-router

This command does not remove the configuration files. To also remove them and the data directory, use:

$> sudo dpkg --purge mysql-router
Note

Alternatively, use apt-get remove mysql-router or apt-get purge mysql-router.

Uninstalling RPM packages

To uninstall an RPM package, use this command:

$> sudo rpm -e mysql-router-community
Note

Similarly, use yum remove mysql-router-community.

This command does not remove the configuration files.

What Is Not Removed

When not purging, the uninstallation process does not remove your configuration files. On Debian systems, this might include files such as:

/etc/init.d/mysqlrouter
/etc/mysqlrouter/mysqlrouter.conf
/etc/apparmor.d/usr.sbin.mysqlrouter