CentOS 7 yum安装MySQL
Posted 白-胖-子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7 yum安装MySQL相关的知识,希望对你有一定的参考价值。
CentOS 光盘源中提供的mysql
CentOS 8:安装光盘直接提供
mysql-server:8.0
mariadb-server : 10.3.17
CentOS 7:安装光盘直接提供
mariadb-server:5.5 服务器包
mariadb 客户端工具包
CentOS 6:
mysql-server:5.1 服务器包
mysql 客户端工具包
CentOS 7默认使用mariaDB
[root@c7-182 ~]# yum provides mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* centosplus: mirrors.huaweicloud.com
* epel: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
1:mariadb-5.5.68-1.el7.x86_64 : A community developed branch
: of MySQL
Repo : base
Matched from:
Provides : mysql = 1:5.5.68-1.el7
[root@c7-182 ~]# yum provides mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* centosplus: mirrors.huaweicloud.com
* epel: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
1:mariadb-server-5.5.68-1.el7.x86_64 : The MariaDB server and
: related files
Repo : base
基于某些特定原因需要再CentOS7上安装MySQL
CentOS 7 利用yum源安装MySQL
在CentOS7上添加MySQL的yum仓库源
- 这里我们使用国内清华大学的yum源,速度比较快
cat > /etc/yum.repos.d/mysql-community.repo <<SUN
[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
SUN
找到喜欢的rpm包wget
wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql-community-server-8.0.25-1.el7.x86_64.rpm
[root@c7-182 ~]# ll -h mysql-community-server-8.0.25-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 428M Apr 26 15:38 mysql-community-server-8.0.25-1.el7.x86_64.rpm
使用yum安装同时解决依赖
yum -y install ./mysql-community-server-8.0.25-1.el7.x86_64.rpm
启动并设为开机启动
systemctl enable --now mysql.service
安装后进行安全设置
- 运行自带安全脚本进行安全设置
mysql_secure_installation
以上是关于CentOS 7 yum安装MySQL的主要内容,如果未能解决你的问题,请参考以下文章