无法在CENTOS7上安装MySQL

q3aa0525  于 2023-02-15  发布在  Mysql
关注(0)|答案(4)|浏览(197)

我在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

1.安装下载的软件包

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

1.安装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
对我遗漏的内容有任何想法/建议;或者如何解决这个问题

yyhrrdl8

yyhrrdl81#

我想我找到了。这是我解决问题的方法。

  • ###第一步:- 删除以前安装的软件包并清除缓存###*
# 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/

  • ###第二步:- 设置百胜存储库###*
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
  • ###第三步:- 禁用mysql repo文件中的所有存储库。###*
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-but-they-are-not-correct-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!
  • ###第七步:试验编号##*
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
zzoitvuj

zzoitvuj2#

在我的情况下,我只是导入GPG-KEY:

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

之后,下一个命令运行无误:

sudo yum install mysql-server -y
3pmvbmvn

3pmvbmvn3#

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

它确实有魔力。

sirbozc5

sirbozc54#

我在第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 won't install in CentOS due to conflict with mariadb
之后,mysql的安装就很顺利了。

相关问题