生成yum源元数据
createrepo /usr/local/yum
[root@localhost tmp]# createrepo /usr/local/yum
Spawning worker 0 with 5 pkgs
Spawning worker 1 with 5 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost tmp]# ls /usr/local/yum
mysqlRPMs repodata
从网易镜像站下载MySQL 5.7 的 bundle包
cd /tmp/
wget http://uni.mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
#也可以从Windows上以QQ旋风等工具下载,然后运行pscp.exe上传到虚拟机
#pscp mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar user@ip:/tmp/
tar -xf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar -C /usr/local/yum/mysqlRPMs
创建文件 mysql-local.repo
[root@localhost tmp]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# cat mysql-local.repo
-bash: EOF: No such file or directory
[root@localhost yum.repos.d]# cat <mysql-local.repo
> #the RPMs of MySQL server
> [mysql-local]
> name=mysql-local
> baseurl=file:///usr/local/yum
> gpgcheck=0
> enabled=1
> EOF
执行yum install命令
yum -y install mysql-community-server