yum 在线安装mysql
直接进入mysql官网
www.mysql.com
进入主页后直接往下翻:
找到DOWNLOADS
点击MySQL Community Server
跳转页面后点击这个画横线的
不用进行登陆直接下载
复制到xshell上就可以
进入yum源仓库
cd /etc/yum.repos.d/
编辑启用哪个版本的mysql
[root@bogon yum.repos.d]# ls
CentOS-Base.repo CentOS-Sources.repo
CentOS-CR.repo CentOS-Vault.repo
CentOS-Debuginfo.repo mysql-community.repo
CentOS-fasttrack.repo mysql-community-source.repo
CentOS-Media.repo
[root@bogon yum.repos.d]# vim mysql-community.repo
查看一下:
```bash
[root@bogon yum.repos.d]# yum list | grep -i ^mysql
安装对应的server包即可
centos7在线安装
CentOS 7.7 yum 在线安装MySQL 5.7.37
1、下载 MySQL Yum Repository
wget -c https://repo.mysql.com//mysql80-community-release-el7-5.noarch.rpm
2、添加 MySQL Yum Repository
[root@node1 ~]# yum localinstall mysql80-community-release-el7-5.noarch.rpm
3、选择安装发行版
禁用8.0:yum-config-manager --disable mysql80-community
启用5.7:yum-config-manager --enable mysql57-community
如果遇到找不到的情况:
yum-config-manager: command not found
这个是因为系统默认没有安装这个命令,这个命令在yum-utils 包里,可以通过命令yum -y install yum-utils 安装就可以了。
验证:
[root@node1 ~]# yum repolist enabled | grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community 230
mysql-tools-community/x86_64 MySQL Tools Community 138
mysql57-community/x86_64 MySQL 5.7 Community Server 564
4、在线安装
yum install mysql-community-server
5、启动数据库
[root@node1 ~]# systemctl enable --now mysqld
6、验证
查看状态:[root@node1 ~]# systemctl status mysqld
查看端口:[root@node1 ~]# netstat -lnpt | grep :3306
查看进程:[root@node1 ~]# ps -ef | grep mysqld