CENTOS7上无法安装MySQL

问题描述 投票:0回答:4

我在 CentOS 7(CentOS Linux 版本 7.9.2009(核心))上从头开始在新服务器上尝试安装 MySQL(7 或 8)。

我已经遵循了我的步骤 - 我过去已经成功完成了很多次,以及许多其他网站,例如:

还有许多其他

所有方法都同意以下步骤:

  1. 下载并添加以下 MySQL Yum 存储库

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

    注意我尝试了不同的版本7-5和8

  2. 安装下载的包

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

    sudo yum install mysql-server -y

第3步是安装失败的地方

mysql -V
-bash: mysql: command not found

我遇到了所有这些错误

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)

我读了这篇看起来相似的文章,但也没有运气

我能够成功安装的唯一版本是一个非常旧的 mysql 版本:5.6

关于我所缺少的任何想法/建议;或者如何解决这个问题?

mysql centos7
4个回答
63
投票

我想我明白了。这是我解决这个问题的方法。

步骤#1: – 删除以前安装的软件包并清除缓存

# 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

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

步骤#2: – 设置 Yum 存储库

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

步骤#3: – 禁用 mysql 存储库文件中的所有存储库。

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

步骤#4 – 安装 MySQL 社区服务器

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

出现以下错误:

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

来自 https://forums.cpanel.net/threads/mysql-upgrade-process-failed-the-gpg-keys-listed-for-the-mysql-8-0-community-server-repository-are-already-installed -但是它们不正确-for.697213/

步骤#5 –导入新的 GPG 密钥

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

步骤 #6 – 重新运行步骤 #3 安装 MySQL 社区服务器

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

收到与每种不同语言相关的多个警告消息;例如与“英语”相关的一个

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

但是,最终消息成功了:

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!

步骤#7:测试

mysql -V

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

步骤#8:仔细检查运行 yum update 时是否没有错误

sudo yum update

通过手动启动、检查状态来确认,

sudo systemctl start mysqld
sudo systemctl status mysqld

10
投票

就我而言,我刚刚导入了 GPG-KEY:

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

之后下一个命令运行没有错误:

sudo yum install mysql-server -y

0
投票
rpm -qa | grep mariadb



rpm -e XXX #If there is an already installed mariadb, uninstall it



rpm -e --nodeps xxx //If the preceding delete action does not work, try force delete

它确实发挥了魔力。


0
投票

我在第 4 步后遇到问题,出现错误:

my.cnf from install of mysql-community-server-8.0.32-1.el7.x86_64 conflicts with file from package MariaDB-common...

我需要跑步:

yum remove mariadb-libs

然后安装MYSQL。发现这里 >> MySQL 由于与 mariadb 冲突而无法安装在 CentOS 中

之后mysql的安装就顺利了。

© www.soinside.com 2019 - 2024. All rights reserved.