CENTOS7上无法安装MySQL

use*_*775 10 mysql centos7

我在 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
    Run Code Online (Sandbox Code Playgroud)

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

  2. 安装下载的包

    sudo yum install mysql80-community-release-el7-3.noarch.rpm -y
    Run Code Online (Sandbox Code Playgroud)
  3. 安装MySQL:

    sudo yum install mysql-server -y
    Run Code Online (Sandbox Code Playgroud)

步骤#3 是安装失败的地方

mysql -V
-bash: mysql: command not found
Run Code Online (Sandbox Code Playgroud)

我得到了所有这些错误

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)
Run Code Online (Sandbox Code Playgroud)

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

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

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

use*_*775 65

我想我明白了。这是我为解决该问题所做的事情。

\n

步骤#1:\xe2\x80\x93 删除以前安装的软件包并清除缓存

\n
# look for the mysql installed packages\nsudo yum list installed | grep mysql\n\nsudo yum remove mysql80-community-release.noarch\n\nsudo yum clean all --verbose\n\n#manually remove remaining mysql cache folders\n#from: https://serverfault.com/questions/1028593/mysql-packages-skipped-dependency-problems\nsudo rm -R /var/cache/yum/x86_64/7/mysql*\n\nsudo yum update\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n

步骤#2:\xe2\x80\x93 设置 Yum 存储库

\n
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm\n
Run Code Online (Sandbox Code Playgroud)\n

步骤#3:\xe2\x80\x93 禁用 mysql 存储库文件中的所有存储库。

\n
sed -i \'s/enabled=1/enabled=0/\' /etc/yum.repos.d/mysql-community.repo\n
Run Code Online (Sandbox Code Playgroud)\n

步骤#4 \xe2\x80\x93 安装 MySQL 社区服务器

\n
yum --enablerepo=mysql80-community install mysql-community-server \n
Run Code Online (Sandbox Code Playgroud)\n

出现以下错误:

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

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

\n

步骤#5 \xe2\x80\x93导入新的 GPG 密钥

\n

根据下面的评论,您可能需要执行“2023”而不是“2022”

\n
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022\n
Run Code Online (Sandbox Code Playgroud)\n

步骤 #6 \xe2\x80\x93 重新运行步骤 #3 安装 MySQL 社区服务器

\n
yum --enablerepo=mysql80-community install mysql-community-server\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n
warning: file /usr/share/mysql/english/errmsg.sys: remove failed: No such file or directory\nwarning: file /usr/share/mysql/english: remove failed: No such file or directory\n
Run Code Online (Sandbox Code Playgroud)\n

然而,最终的消息是成功的:

\n
Installed:\n  mysql-community-libs.x86_64 0:8.0.28-1.el7                                                  \n  mysql-community-libs-compat.x86_64 0:8.0.28-1.el7                                           \n  mysql-community-server.x86_64 0:8.0.28-1.el7                                                \n\nDependency Installed:\n  mysql-community-client.x86_64 0:8.0.28-1.el7                                                \n  mysql-community-client-plugins.x86_64 0:8.0.28-1.el7                                        \n  mysql-community-common.x86_64 0:8.0.28-1.el7                                                \n  mysql-community-icu-data-files.x86_64 0:8.0.28-1.el7                                        \n\nReplaced:\n  mariadb-libs.x86_64 1:5.5.68-1.el7                                                          \n\nComplete!\n
Run Code Online (Sandbox Code Playgroud)\n

步骤#7:测试

\n
mysql -V\n\n# output #\nmysql\xc2\xa0Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n
sudo yum update\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n
sudo systemctl start mysqld\nsudo systemctl status mysqld\n
Run Code Online (Sandbox Code Playgroud)\n

  • @ShubhamSrivastava - 上述步骤仅用于程序包设置:完成上述操作后,您必须:A)获取默认给定密码:MySQL 版本 8.0 或更高版本在 /var/log/mysqld.log 中生成临时随机密码安装 要查看密码,请运行: sudo grep 'password' /var/log/mysqld.log 响应:为 root@localhost 生成临时密码 B) 运行安全安装 sudo mysql_secure_installation (3认同)

ktr*_*yak 10

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

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
Run Code Online (Sandbox Code Playgroud)

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

sudo yum install mysql-server -y
Run Code Online (Sandbox Code Playgroud)