1. 下载安装包
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
这个链接的文件包含MySQL所有组件,而我们安装需要的组件如下:
(1) mysql-community-common-8.0.11-1.el7.x86_64.rpm
(2) mysql-community-libs-8.0.11-1.el7.x86_64.rpm
(3) mysql-community-client-8.0.11-1.el7.x86_64.rpm
(4) mysql-community-server-8.0.11-1.el7.x86_64.rpm
你也可以按照这个列表逐个下载,本文为了方便,选择了全集包。
2. 查询并删除CentOS自带的Mariadb
(1) 查询:
rpm -qa|grep mariadb
得到结果:
(2) 删除:
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.centos.x86_64
3.按照1中的列表顺序逐个安装MySQL所需组件
yum localinstall mysql-community-common-8.0.11-1.el7.x86_64.rpm
yum localinstall mysql-community-libs-8.0.11-1.el7.x86_64.rpm
yum localinstall mysql-community-client-8.0.11-1.el7.x86_64.rpm
yum localinstall mysql-community-server-8.0.11-1.el7.x86_64.rpm
4. 检查安装结果
rpm -qa | grep mysql
5. 开放端口
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent sudo firewall-cmd --reload sudo firewall-cmd --list-ports
6. 启动
systemctl start mysqld systemctl status mysqld
原文地址:https://www.cnblogs.com/eagle6688/p/8975090.html
时间: 2024-10-06 22:23:37