linux上安装MySQL

编程

一、下载mysql服务软件包

  地址:https://dev.mysql.com/downloads/mysql/

  rpm package:是某个特定的包,比如server,client,devle等    
  rpm bundle:是该版本所有包的集合                                         
  Compressed TAR Archive,是源码,必须用源码方式安装  

  Compatibility Libraries:兼容库  

  Shared Libraries:共享库  

  Development Libraries:开发库  

  Test Suite:测试套件

  Client Utilities:客户端工具

  下载时注意选则好对应的版本

二、安装(contos7.2)

  (1)rpm -ivh  mysql-community-libs-8.0.18-1.el7.x86_64

  报错信息:

  error: Failed dependencies:

  mariadb-libs is obsoleted by mysql-community-libs-8.0.18-1.el7.x86_64

  原因:mariadb-libs和 mysql-community-libs冲突

  解决办法:卸载mariadb-libs

  a.查询mariadb-libs的包名

  [root@izm5e8nyz28va3a786y465z src]# rpm -qa |grep mariadb

  mariadb-libs-5.5.64-1.el7.x86_64

  b.卸载该包

   [root@izm5e8nyz28va3a786y465z src]# rpm -ev mariadb-libs-5.5.64-1.el7.x86_64 

    error: Failed dependencies:

    libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
    libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64

    报错原因:postfix是mariadb 的依赖包,要先卸载它

    [root@izm5e8nyz28va3a786y465z src]# rpm -qa |grep postfix

    postfix-2.10.1-7.el7.x86_64
    [root@izm5e8nyz28va3a786y465z src]# rpm -ev postfix-2.10.1-7.el7.x86_64
    error: Failed dependencies:
    /usr/sbin/sendmail is needed by (installed) redhat-lsb-core-4.1-27.el7.centos.1.x86_64
    [root@izm5e8nyz28va3a786y465z src]# rpm -qa |grep redhat-lsb
    redhat-lsb-core-4.1-27.el7.centos.1.x86_64
    redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64
    [root@izm5e8nyz28va3a786y465z src]# rpm -ev redhat-lsb-core-4.1-27.el7.centos.1.x86_64
    Preparing packages...
    redhat-lsb-core-4.1-27.el7.centos.1.x86_64

    [root@izm5e8nyz28va3a786y465z src]# rpm -ev postfix-2.10.1-7.el7.x86_64

    Preparing packages...
    postfix-2:2.10.1-7.el7.x86_64

    上述步骤成功卸载掉mariadb-libs的依赖
    [root@izm5e8nyz28va3a786y465z src]# rpm -ev mariadb-libs-5.5.64-1.el7.x86_64
    Preparing packages...
    mariadb-libs-1:5.5.64-1.el7.x86_64

    继续安装:

    [root@izm5e8nyz28va3a786y465z src]# rpm -ivh mysql-community-libs-8.0.18-1.el7.x86_64.rpm
    warning: mysql-community-libs-8.0.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Preparing... ################################# [100%]
    Updating / installing...
    1:mysql-community-libs-8.0.18-1.el7################################# [100%]

    mysql-community-libs-8.0.18-1.el7包安装成功

    (2) rpm -ivh mysql-community-common-8.0.18-1.el7.x86_64.rpm

    (3) rpm -ivh mysql-community-client-8.0.18-1.el7.x86_64.rpm

    (4) rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm 

      error: Failed dependencies:

      libaio.so.1()(64bit) is needed by mysql-community-server-8.0.18-1.el7.x86_64

      libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-8.0.18-1.el7.x86_64
      libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-8.0.18-1.el7.x86_64

      解决依赖关系:

      [root@izm5e8nyz28va3a786y465z src]# yum list |grep libaio

      libaio.i686 0.3.109-13.el7 base
      libaio.x86_64 0.3.109-13.el7 base
      libaio-devel.i686 0.3.109-13.el7 base
      libaio-devel.x86_64 0.3.109-13.el7 base

      查询到4个相关的依赖包,只需安装libaio.x86_64    libaio-devel.x86_64

      yum  -y install  libaio.x86_64    libaio-devel.x86_64

      [root@izm5e8nyz28va3a786y465z src]# rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm 

      warning: mysql-community-server-8.0.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
      Preparing... ################################# [100%]
      Updating / installing...
        1:mysql-community-server-8.0.18-1.e################################# [100%]

    (5)rpm -ivh mysql-community-devel-8.0.18-1.el7.x86_64.rpm 

      error: Failed dependencies:

      pkgconfig(openssl) is needed by mysql-community-devel-8.0.18-1.el7.x86_64

      解决依赖关系:

      yum  -y  install  openssl  openssl-devel

      [root@izm5e8nyz28va3a786y465z src]# rpm -ivh mysql-community-devel-8.0.18-1.el7.x86_64.rpm 

      warning: mysql-community-devel-8.0.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
      Preparing... ################################# [100%]
      Updating / installing...
      1:mysql-community-devel-8.0.18-1.el################################# [100%]

    至此Mysql安装成功

    小结:1. 卸载掉冲突组件  mariadb

        rpm -ev redhat-lsb-core-4.1-27.el7.centos.1.x86_64  postfix-2.10.1-7.el7.x86_64   mariadb-libs-5.5.64-1.el7.x86_64

       2.安装相关依赖:

        yum  -y  install  openssl  openssl-devel  libaio    libaio-devel

三、mysql服务管理

 

 

 

 

以上是 linux上安装MySQL 的全部内容, 来源链接: utcz.com/z/510658.html

回到顶部