MySQL安装方式(5.7版本和8.0版本)

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.查看并卸载mariadbpostfix

[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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值