5.7版本安装MySQL
rpm安装mysql
1.首先检查机器里是否已经存在MySQL
[root@localhost ~]# rpm -qa | grep mysql
mysql-community-server-5.7.14-1.el7.x86_64
mysql-community-libs-5.7.14-1.el7.x86_64
mysql-community-common-5.7.14-1.el7.x86_64
mysql-community-client-5.7.14-1.el7.x86_64
[root@localhost ~]#
2.去官网下载相应的rpm包:https://dev.mysql.com/downloads/mysql/
并上传
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg
mysql-5.7.14-1.el7.x86_64.rpm-bundle.tar
[root@localhost ~]#
3.解压mysql-5.7.14-1.el7.x86_64.rpm-bundle.tar
[root@localhost ~]# tar xf mysql-5.7.14-1.el7.x86_64.rpm-bundle.tar
[root@localhost ~]# ll
解压后会得到以下rpm安装文件:
4.查看并卸载mariadb
和 postfix
[root@localhost ~]# rpm -qa | grep ^mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost ~]# rpm -e mariadb-libs
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_ 64
You have new mail in /var/spool/mail/root
[root@localhost ~]# rpm -e mariadb-libs postfix
[root@localhost ~]# rpm -qa | grep ^mariadb
[root@localhost ~]#
4.安装
- 安装服务端
[root@localhost ~]# yum localinstall mysql-community-server-5.7.14-1.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql-community-server-5.7.14-1.el7.x86_64.rpm: mysql-community-server-5.7.14-1.el7.x86_64
Marking mysql-community-server-5.7.14-1.el7.x86_64.rpm to be installed
......(省略)
--> Finished Dependency Resolution
Error: Package: mysql-community-server-5.7.14-1.el7.x86_64 (/mysql-community-server-5.7.14-1.el7.x86_64)
Requires: mysql-community-client(x86-64) >= 5.7.9
Error: Package: mysql-community-server-5.7.14-1.el7.x86_64 (/mysql-community-server-5.7.14-1.el7.x86_64)
Requires: mysql-community-common(x86-64) = 5.7.14-1.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@localhost ~]#
根据报错信息安装所需要包
- 安装客户端和服务端和客户端的公共文件(
mysql-community-client-5.7.14-1.el7.x86_64.rpm
mysql-community-common-5.7.14-1.el7.x86_64.rpm
)
[root@localhost ~]# yum localinstall mysql-community-server-5.7.14-1.el7.x86_64.rpm mysql-community-client-5.7.14-1.el7.x86_64.rpm mysql-community-common-5.7.14-1.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql-community-server-5.7.14-1.el7.x86_64.rpm: mysql-community-server-5.7.14-1.el7.x86_64
Marking mysql-community-server-5.7.14-1.el7.x86_64.rpm to be installed
......(省略)
--> Finished Dependency Resolution
Error: Package: mysql-community-client-5.7.14-1.el7.x86_64 (/mysql-community-client-5.7.14-1.el7.x86_64)
Requires: mysql-community-libs(x86-64) >= 5.7.9
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@localhost ~]#
根据报错信息安装所需要包
- 安装客户端共享库(
mysql-community-libs-5.7.14-1.el7.x86_64.rpm
)
[root@localhost ~]# yum localinstall mysql-community-server-5.7.14-1.el7.x86_64.rpm mysql-community-client- 5.7.14-1.el7.x86_64.rpm mysql-community-common-5.7.14-1.el7.x86_64.rpm mysql-community-libs-5.7.14-1.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql-community-server-5.7.14-1.el7.x86_64.rpm: mysql-community-server-5.7.14-1.el7.x86_64
Marking mysql-community-server-5.7.14-1.el7.x86_64.rpm to be installed
......(省略)
Installed:
mysql-community-client.x86_64 0:5.7.14-1.el7 mysql-community-common.x86_64 0:5.7.14-1.el7
mysql-community-libs.x86_64 0:5.7.14-1.el7 mysql-community-server.x86_64 0:5.7.14-1.el7
Complete!
[root@localhost ~]#
安装成功!
5.epel https://mirrors.tuna.tsinghua.edu.cn/
- 进入清华大学开源软件镜像站官网
- 复制链接
https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-7.noarch.rpm
[root@localhost ~]# yum install -y https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-7.noarch.rpm
Loaded plugins: fastestmirror, langpacks
epel-release-latest-7.noarch.rpm | 15 kB 00:00:00
Examining /var/tmp/yum-root-qsICr2/epel-release-latest-7.noarch.rpm: epel-release-7-11.noarch
Marking /var/tmp/yum-root-qsICr2/epel-release-latest-7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 w