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

For supported Yum-based platforms (see Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”, for a list), you can replace a third-party distribution of MySQL with the latest GA release from MySQL using the MySQL Yum repository. According to how your third-party distribution of MySQL was installed, there are different steps to follow:

Replacing a Native Third-Party Distribution of MySQL

If you have installed a third-party distribution of MySQL from a native software repository (that is, a software repository provided by your own Linux distribution), follow these 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. Adding the MySQL Yum Repository

    Add the MySQL Yum repository to your system's repository list by following the instructions given in Adding the MySQL Yum Repository.

  3. Replacing the Native Third-Party Distribution by a Yum Update

    By design, the MySQL Yum repository will replace your native, third-party MySQL when you perform a yum update command on the system, or a yum update mysql-server.

After updating MySQL using the Yum repository, applications compiled with older versions of the shared client libraries should continue to work. However, if you want to recompile applications and dynamically link them with the updated libraries, see Upgrading to the Shared Client Libraries, for some special considerations.

Replacing a Nonnative Third-Party Distribution of MySQL

If you have installed a third-party distribution of MySQL from a nonnative software repository (that is, a software repository not provided by your own Linux distribution), follow these 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, Nonnative Repositories

    Before you can use the MySQL Yum repository for installing MySQL, you must stop your system from receiving MySQL packages from any third-party, nonnative Yum repositories.

    For example, if you have installed MariaDB using their own software repository, get a list of the installed MariaDB packages using 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 the installed packages (MariaDB-common, MariaDB-compat, and MariaDB-server) and the source of them (a nonnative software repository named mariadb).

    The next step is to stop Yum from receiving packages from the nonnative repository. If the yum-config-manager utility is supported on your platform, you can use this command:

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

    You can perform the same task by removing the entry for mariadb existing in one of the repository files under the /etc/yum.repos.d/ directory. This is how the entry typically looks like:

    [mariadb] name = MariaDB
     baseurl = [base URL for repository]
     gpgkey = [URL for GPG key]
     gpgcheck =1 

    The entry is usually found in the file /etc/yum.repos.d/MariaDB.repo. Delete that file, or, if the entry is in another file, delete the entry from that file.

  3. Uninstalling the Nonnative Third-Party MySQL Distribution of MySQL

    The nonnative third-party MySQL distribution must first be uninstalled before you can use the MySQL Yum repository to install MySQL. For the packages found in Step 2 above, uninstall them with the following command:

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

  4. Installing MySQL with the MySQL Yum Repository

    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.10, “Postinstallation Setup and Testing”.

    Note

    For EL7-based platforms: See Compatibility Information for EL7-based platforms.