Search code examples
mysqlcentos7

Unable to install MySQL on CENTOS7


I'm on CentOS 7(CentOS Linux release 7.9.2009 (Core)) starting from scratch on a new server trying to install MySQL (7 or 8).

I have followed my steps -which I have successfully completed many times in the past, as well many other sites such as:

and many others

All the methods agree on these steps:

  1. Download and add the following MySQL Yum repository

    sudo wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

    Note I tried different versions 7-5, and 8

  2. install the downloaded package

    sudo yum install mysql80-community-release-el7-3.noarch.rpm -y
  3. install MySQL:

    sudo yum install mysql-server -y

On Step #3 is where the installation fails

mysql -V
-bash: mysql: command not found

And I get all these errors

Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libtirpc.so.3()(64bit)
Error: Package: mysql-community-libs-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-libs-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libtirpc.so.3(TIRPC_0.3.3)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.22)(64bit)
Error: Package: mysql-community-client-plugins-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)
Error: Package: mysql-community-client-plugins-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: mysql-community-libs-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.8)(64bit)
Error: Package: mysql-community-client-plugins-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.8)(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libncurses.so.6()(64bit)
Error: Package: mysql-community-client-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libtinfo.so.6()(64bit)
Error: Package: mysql-community-libs-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.11)(64bit)
Error: Package: mysql-community-client-plugins-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libc.so.6(GLIBC_2.25)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: mysql-community-server-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libtirpc.so.3(TIRPC_0.3.0)(64bit)
Error: Package: mysql-community-client-plugins-8.0.28-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)

I read this post which looks similar, but no luck either

the only version that I'm able to successfully install is a very old mysql version: 5.6

Any ideas/suggestions on what I am missing; or how to solve this?


Solution

  • I think I got it. Here is what I did to solve it.

    Step #1: – Remove previous installed packages and clear cache

    # look for the mysql installed packages
    sudo yum list installed | grep mysql
    
    sudo yum remove mysql80-community-release.noarch
    
    sudo yum clean all --verbose
    
    #manually remove remaining mysql cache folders
    #from: https://serverfault.com/questions/1028593/mysql-packages-skipped-dependency-problems
    sudo rm -R /var/cache/yum/x86_64/7/mysql*
    
    sudo yum update
    

    from: https://tecadmin.net/install-mysql-8-on-centos/

    Step #2: – Setup Yum Repository

    rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
    

    Step #3: – disable all repositories in mysql repo file.

    sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo
    

    Step #4 – Install MySQL Community Server

    yum --enablerepo=mysql80-community install mysql-community-server 
    

    Got the following error:

    The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.
    Check that the correct key URLs are configured for this repository.
    
    
     Failing package is: mysql-community-client-8.0.28-1.el7.x86_64
     GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    

    From https://forums.cpanel.net/threads/mysql-upgrade-process-failed-the-gpg-keys-listed-for-the-mysql-8-0-community-server-repository-are-already-installed-but-they-are-not-correct-for.697213/

    Step #5 –import the new GPG key

    per comments below, you might need to do '2023' instead of '2022'

    rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
    

    Step #6 – Re-run STEP #3 Install MySQL Community Server

    yum --enablerepo=mysql80-community install mysql-community-server
    

    Got multiple warning message related to every different language; for example the one related to 'english'

    warning: file /usr/share/mysql/english/errmsg.sys: remove failed: No such file or directory
    warning: file /usr/share/mysql/english: remove failed: No such file or directory
    

    However, final messages were successful:

    Installed:
      mysql-community-libs.x86_64 0:8.0.28-1.el7                                                  
      mysql-community-libs-compat.x86_64 0:8.0.28-1.el7                                           
      mysql-community-server.x86_64 0:8.0.28-1.el7                                                
    
    Dependency Installed:
      mysql-community-client.x86_64 0:8.0.28-1.el7                                                
      mysql-community-client-plugins.x86_64 0:8.0.28-1.el7                                        
      mysql-community-common.x86_64 0:8.0.28-1.el7                                                
      mysql-community-icu-data-files.x86_64 0:8.0.28-1.el7                                        
    
    Replaced:
      mariadb-libs.x86_64 1:5.5.68-1.el7                                                          
    
    Complete!
    

    Step #7: test

    mysql -V
    
    # output #
    mysql Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)
    

    Step #8: Double check that no errors when running yum update

    sudo yum update
    

    Confirm by starting it manually, checking status,

    sudo systemctl start mysqld
    sudo systemctl status mysqld