在 CentOS 8 上安装 MySQL 5.7

在 CentOS 8 上安装 MySQL 5.7

我正在尝试在 CentOS 8 上安装 MySQL 5.7 社区服务器,但我无法找到配置任何有效的存储库的方法。

$ yum repolist all | grep mysql
CentOS-8 - AppStream                            2.2 kB/s | 4.3 kB     00:02    
CentOS-8 - Base                                 2.3 kB/s | 3.9 kB     00:01    
CentOS-8 - Extras                               2.1 kB/s | 1.5 kB     00:00    
CentOS-8 - PowerTools                           7.8 kB/s | 4.3 kB     00:00    

使用 yum / dnf 安装都给出相同的结果:

$ sudo dnf install @mysql
Last metadata expiration check: 0:07:30 ago on Tue 03 Dec 2019 02:16:26 AM UTC.
Dependencies resolved.
==============================================================================================================
 Package                              Arch      Version                                  Repository      Size
==============================================================================================================
Installing group/module packages:
 mysql-server                         x86_64    8.0.17-3.module_el8.0.0+181+899d6349     AppStream       22 M
Installing dependencies:
 mariadb-connector-c-config           noarch    3.0.7-1.el8                              AppStream       13 k
 mecab                                x86_64    0.996-1.module_el8.0.0+41+ca30bab6.9     AppStream      397 k
 mysql                                x86_64    8.0.17-3.module_el8.0.0+181+899d6349     AppStream       11 M
 mysql-common                         x86_64    8.0.17-3.module_el8.0.0+181+899d6349     AppStream      143 k
 mysql-errmsg                         x86_64    8.0.17-3.module_el8.0.0+181+899d6349     AppStream      557 k
 protobuf-lite                        x86_64    3.5.0-7.el8                              AppStream      150 k
 libaio                               x86_64    0.3.110-12.el8                           BaseOS          32 k
 numactl-libs                         x86_64    2.0.12-2.el8                             BaseOS          36 k
 policycoreutils-python-utils         noarch    2.8-16.1.el8                             BaseOS         228 k

是否可以在 CentOS 8 上安装 MySQL 5.7?

答案1

正如托尼上面提到的,[已接受的答案],这里是有关如何在 centos 8 上安装 mysql 5.7 的分步指南。

以防万一博客有一天宕机,以下是所涉及的所有步骤的摘录

步骤1:删除mysql默认流

sudo dnf remove @mysql
sudo dnf module reset mysql && sudo dnf module disable mysql

步骤2:添加mysql 5.7存储库

文件:

/etc/yum.repos.d/mysql-community.repo

内容:

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0

[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=0

[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=0

第三步:照常安装

sudo dnf --enablerepo=mysql57-community install mysql-community-server

其余步骤(密码、安全安装与5.7安装相同)

#start
sudo systemctl enable --now mysqld.service
#read temp password
grep 'A temporary password' /var/log/mysqld.log |tail -1
#secure it
sudo mysql_secure_installation

答案2

我按照此处的说明进行操作,并能够在 CentOS 8 上安装 MySQL 5.7

在 CentOS 8 / RHEL 8 Linux 上安装 MySQL 5.7

[root@mysql01 ~]cat /etc/*release* | grep release
CentOS Linux release 8.0.1905 (Core)

[root@mysql01 ~]# rpm -qi mysql-community-server
Name        : mysql-community-server
Version     : 5.7.29
Release     : 1.el7
Architecture: x86_64

相关内容