【Linux operation 28】麒麟信安操作系统3.3 --在线安装mysql

1、先检查系统是否装有mysql

rpm -qa | grep mysql 这里执行安装命令是无效的,因为系统默认是Mariadb,所以执行以下命令只是更新Mariadb数据库 yum install mysql
删除 yum remove mysql

2、下载mysql的repo源

在安装前我们需要先去官网下载 Yum 资源包,下载地址为:https://dev.mysql.com/downloads/repo/yum/
请添加图片描述

wget http://repo.mysql.com/mysql80-community-release-el7-6.noarch.rpm  #下载

rpm -ivh mysql80-community-release-el7-6.noarch.rpm   #安装

3、安装mysql

<1> 先安装,否则可能会报错

yum install glibc.i686 yum list libstdc++*
Error: Package: mysql-community-libs-5.6.35-2.el7.x86_64 (mysql56-community)
           Requires: libc.so.6(GLIBC_2.17)(64bit)
Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community)
           Requires: libc.so.6(GLIBC_2.17)(64bit)
Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community)
           Requires: systemd
Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Error: Package: mysql-community-client-5.6.35-2.el7.x86_64 (mysql56-community)
           Requires: libc.so.6(GLIBC_2.17)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

<2>安装mysql 会出现问题

 yum install mysql-server
[root@localhost yum.repos.d]# yum install mysql-server
......

获取 GPG 密钥失败:[Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022"

解决办法:rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

<3> 之后执行命令安装mysql

[root@localhost yum.repos.d]# yum install mysql-server
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Determining fastest mirrors
base                                                                                                                                                                                                   | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                                                                       | 3.5 kB  00:00:00     
extras                                                                                                                                                                                                 | 2.9 kB  00:00:00     
mysql-connectors-community                                                                                                                                                                             | 2.6 kB  00:00:00     
mysql-tools-community                                                                                                                                                                                  | 2.6 kB  00:00:00     
mysql80-community                                                                                                                                                                                      | 2.6 kB  00:00:00     
updates                                                                                                                                                                                                | 2.9 kB  00:00:00     
(1/9): docker-ce-stable/x86_64/updateinfo                                                                                                                                                              |   55 B  00:00:01     
(2/9): docker-ce-stable/x86_64/primary_db                                                                                                                                                              |  76 kB  00:00:01     
(3/9): base/x86_64/group_gz                                                                                                                                                                            | 153 kB  00:00:02     
(4/9): extras/x86_64/primary_db                                                                                                                                                                        | 246 kB  00:00:02     
(5/9): mysql-tools-community/x86_64/primary_db                                                                                                                                                         |  86 kB  00:00:00     
(6/9): mysql80-community/x86_64/primary_db                                                                                                                                                             | 211 kB  00:00:01     
(7/9): mysql-connectors-community/x86_64/primary_db                                                                                                                                                    |  87 kB  00:00:06     
(8/9): updates/x86_64/primary_db                                                                                                                                                                       |  15 MB  00:00:10     
(9/9): base/x86_64/primary_db                                                                                                                                                                          | 6.1 MB  00:00:13     
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.8.0.29-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 8.0.29-1.el7,它被软件包 mysql-community-server-8.0.29-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-icu-data-files = 8.0.29-1.el7,它被软件包 mysql-community-server-8.0.29-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.11,它被软件包 mysql-community-server-8.0.29-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.8.0.29-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-client-plugins = 8.0.29-1.el7,它被软件包 mysql-community-client-8.0.29-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.8.0.22-1.ky3.kb1 将被 升级
---> 软件包 mysql-community-common.x86_64.0.8.0.29-1.el7 将被 更新
---> 软件包 mysql-community-icu-data-files.x86_64.0.8.0.29-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.22-1.ky3.kb1 将被 升级
--> 正在处理依赖关系 mysql-community-client-plugins = 8.0.22-1.ky3.kb1,它被软件包 mysql-community-libs-8.0.22-1.ky3.kb1.x86_64 需要
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.29-1.el7 将被 更新
--> 正在检查事务
---> 软件包 mysql-community-libs.x86_64.0.8.0.22-1.ky3.kb1 将被 升级
---> 软件包 mysql-community-libs.x86_64.0.8.0.29-1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================================================================================================== Package                                                            架构                                       版本                                               源                                                     大小
==============================================================================================================================================================================================================================正在安装:
 mysql-community-server                                             x86_64                                     8.0.29-1.el7                                       mysql80-community                                      53 M
为依赖而安装:
 mysql-community-client                                             x86_64                                     8.0.29-1.el7                                       mysql80-community                                      14 M
 mysql-community-icu-data-files                                     x86_64                                     8.0.29-1.el7                                       mysql80-community                                     2.1 M
为依赖而更新:
 mysql-community-client-plugins                                     x86_64                                     8.0.29-1.el7                                       mysql80-community                                     2.5 M
 mysql-community-common                                             x86_64                                     8.0.29-1.el7                                       mysql80-community                                     633 k
 mysql-community-libs                                               x86_64                                     8.0.29-1.el7                                       mysql80-community                                     1.5 M

事务概要
==============================================================================================================================================================================================================================安装  1 软件包 (+2 依赖软件包)
升级           ( 3 依赖软件包)

总下载量:74 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/6): mysql-community-client-8.0.29-1.el7.x86_64.rpm                                                                                                                                                  |  14 MB  00:00:02     
(2/6): mysql-community-common-8.0.29-1.el7.x86_64.rpm                                                                                                                                                  | 633 kB  00:00:00     
(3/6): mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm                                                                                                                                          | 2.1 MB  00:00:00     
(4/6): mysql-community-libs-8.0.29-1.el7.x86_64.rpm                                                                                                                                                    | 1.5 MB  00:00:00     
(5/6): mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm                                                                                                                                          | 2.5 MB  00:00:06     
(6/6): mysql-community-server-8.0.29-1.el7.x86_64.rpm                                                                                                                                                  |  53 MB  00:00:08     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------总计                                                                                                                                                                                          5.6 MB/s |  74 MB  00:00:13     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : mysql-community-common-8.0.29-1.el7.x86_64                                                                                                                                                                1/9 
  正在更新    : mysql-community-client-plugins-8.0.29-1.el7.x86_64                                                                                                                                                        2/9 
  正在更新    : mysql-community-libs-8.0.29-1.el7.x86_64                                                                                                                                                                  3/9 
  正在安装    : mysql-community-client-8.0.29-1.el7.x86_64                                                                                                                                                                4/9 
  正在安装    : mysql-community-icu-data-files-8.0.29-1.el7.x86_64                                                                                                                                                        5/9 
  正在安装    : mysql-community-server-8.0.29-1.el7.x86_64                                                                                                                                                                6/9 
  清理        : mysql-community-libs-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                              7/9 
  清理        : mysql-community-common-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                            8/9 
  清理        : mysql-community-client-plugins-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                    9/9 
  验证中      : mysql-community-icu-data-files-8.0.29-1.el7.x86_64                                                                                                                                                        1/9 
  验证中      : mysql-community-client-8.0.29-1.el7.x86_64                                                                                                                                                                2/9 
  验证中      : mysql-community-client-plugins-8.0.29-1.el7.x86_64                                                                                                                                                        3/9 
  验证中      : mysql-community-server-8.0.29-1.el7.x86_64                                                                                                                                                                4/9 
  验证中      : mysql-community-common-8.0.29-1.el7.x86_64                                                                                                                                                                5/9 
  验证中      : mysql-community-libs-8.0.29-1.el7.x86_64                                                                                                                                                                  6/9 
  验证中      : mysql-community-libs-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                              7/9 
  验证中      : mysql-community-common-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                            8/9 
  验证中      : mysql-community-client-plugins-8.0.22-1.ky3.kb1.x86_64                                                                                                                                                    9/9 

已安装:
  mysql-community-server.x86_64 0:8.0.29-1.el7                                                                                                                                                                                

作为依赖被安装:
  mysql-community-client.x86_64 0:8.0.29-1.el7                                                              mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7                                                             

作为依赖被升级:
  mysql-community-client-plugins.x86_64 0:8.0.29-1.el7                           mysql-community-common.x86_64 0:8.0.29-1.el7                           mysql-community-libs.x86_64 0:8.0.29-1.el7                          

完毕!

猜你喜欢

转载自blog.csdn.net/qq_22938603/article/details/124664011