参考知乎如下链接
在 CentOS 7 上安装 MySQL 8.0
根据自己的安装实践,最好先设置镜像,即文中提到的清华镜像.
Mysql Community Edition 镜像使用帮助
内文如下:
Debian/Ubuntu 用户
再选择你的 Debian/Ubuntu 版本,文本框中内容写进 /etc/apt/sources.list.d/mysql-community.list
RHEL/CentOS 用户
新建 /etc/yum.repos.d/mysql-community.repo,内容如下:
Centos7
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
[mysql-tools-community]
name=MySQL Tools Community
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-tools-community-el7-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
[mysql-5.6-community]
name=MySQL 5.6 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.6-community-el7-$basearch/
enabled=0
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
[mysql-5.7-community]
name=MySQL 5.7 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
[mysql-8.0-community]
name=MySQL 8.0 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
注意如下:
yum install mysql80-community-release-el7-3.noarch.rpm
上面粗体部分要根据下载的rpm文件,进行相应的修改。
还有如果出现
The GPG keys listed for the “MySQL 8.0 Community Server“…but they are not correct for this package
错误,请运行:(参考了:https://blog.csdn.net/fangbaobao_luhw/article/details/124695082)
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
以上记录仅供查询.
马拉孙 2021-11-11 于北京泛五地区