2.5.2 Replacing a Third-Party Distribution of MySQL Using the MySQL Yum Repository

Different distributions of MySQL are distributed by different parties through their own software repositories or download sites. You can replace a third-party distribution of MySQL using the MySQL Yum repository in a few steps.

  1. Backing Up Your Database

    To avoid loss of data, always back up your database before trying to replace your MySQL installation using the MySQL Yum repository. See Chapter 7, Backup and Recovery on how to back up your database.

  2. Stopping Yum from Receiving MySQL Packages from Third-Party, Non-Native Repositories

    Before you can use the MySQL Yum repository for installing (or updating) MySQL, you must stop your system from receiving MySQL packages from any third-party, non-native Yum repositories.

    One way to check whether Yum is now receiving third-party MySQL distributions from other repositories is to use the following command:

    shell> yum list installed mysql\* 

    This is a sample output for the command:

    mysql.i686              5.1.69-1.el6_4      @updates
    mysql-libs.i686         5.1.69-1.el6_4      @updates
    mysql-server.i686       5.1.69-1.el6_4      @updates

    The output shows the names of the packages of the third-party MySQL distribution that are installed and, on the right-hand side, the repository (which is named updates, a native repository for the Linux distribution) from which they were installed.

    However, sometimes the names of the packages of the third-party distribution might not contain the string mysql in it. It might be useful to search also with this command:

    shell> yum --disablerepo=\* provides mysql\*

    The following is a sample output of the command:

    MariaDB-compat-10.0.4-1.i686 ...
    Repo        : installed
    Matched from:
    Other       : mysql-libs
    MariaDB-server-10.0.4-1.i686 ...
    Repo        : installed
    Matched from:
    Other       : mysql-server

    From the result we can see the names of some of the packages for the installed third-party distribution of MySQL (MariaDB-server and MariaDB-compat). To try to get an exhaustive list of packages installed for this third-party distribution of MySQL, it might be helpful to search for installed packages of similar names with, for example, the following command:

    shell> yum list installed mariadb\*

    This is a sample output for the command:

    MariaDB-common.i686                      10.0.4-1                       @mariadb
    MariaDB-compat.i686                      10.0.4-1                       @mariadb
    MariaDB-server.i686                      10.0.4-1                       @mariadb

    From the command output, we can identify all the installed packages (MariaDB-common, MariaDB-compat, and MariaDB-server) and the third-party Yum repository from which they were installed (named mariadb).

    The next step is to stop Yum from receiving packages from the third-party Yum repository:

    shell> sudo yum-config-manager --disable mariadb


    For platforms like Fedora 19 and 20 that install MySQL from the native repositories, this step is usually not required, unless you have explicitly added a third-party Yum repository for MySQL packages.

  3. Adding the MySQL Yum Repository

    Once the third-party Yum repository has been disabled, add the MySQL Yum repository to your system's repository list by following the instructions given in Adding the MySQL Yum Repository.

  4. Uninstalling the Third-Party MySQL Distribution and Installing MySQL with the MySQL Yum Repository

    The installed third-party MySQL distribution must first be uninstalled before you can use the MySQL Yum repository to install MySQL, or the installation process will give an error.

    Assuming that, as in the example above, the third-part MySQL packages you have found are named MariaDB-common, MariaDB-compat, and MariaDB-server, uninstall them with the following command:

    shell> sudo yum remove MariaDB-common MariaDB-compat MariaDB-server


    If your third-party MySQL distribution was not installed by Yum or by an RPM installer, you will not be able to detect and then uninstall it by Yum. If you are not sure what to do in that case, consult a system administrator or the original third-party distributor.

    Then, install MySQL from the MySQL Yum repository with the following command:

    shell> sudo yum install mysql-community-server 

    The MySQL server and other components required to run the server, including the client, the shared client libraries, and the common error messages and character sets for client and server, are now installed from the MySQL Yum repository. To install more components for MySQL, see Installing Additional MySQL Products and Components with Yum. Follow the postinstallation procedures explained in Section 2.9, “Postinstallation Setup and Testing”.