Centos7 安装 mysql5.7

Posted 风清扬dyf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 安装 mysql5.7相关的知识,希望对你有一定的参考价值。

此前在centos6.5装mysql5.7,在执行yum install mysql-community-server时出现问题

[[email protected] ~]# yum install mysql-community-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.17)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el7.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: mysql-community-client-5.7.18-1.el7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: mysql-community-client-5.7.18-1.el7.x86_64
---> Package mysql-community-server.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.17)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: mysql-community-client-5.7.18-1.el7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: mysql-community-client-5.7.18-1.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: mysql-community-libs-5.7.18-1.el7.x86_64
---> Package mysql-community-server.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.17)(64bit) for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-community-client-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Error: Package: mysql-community-server-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: libc.so.6(GLIBC_2.17)(64bit)
Error: Package: mysql-community-client-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: mysql-community-libs-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: mysql-community-server-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Error: Package: mysql-community-server-5.7.18-1.el7.x86_64 (mysql57-community)
           Requires: systemd
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[[email protected] ~]# 

在网上搜了很多 有说是5.7需要内存在1GB以上的 改过内存也没见效果,有的还说要执行yum remove mysql-lib*然后再执行yum update更新在安装的也不可以

后来搜到一篇文章说这是由于安装顺序不同导致相互依赖出了问题 按照下面的方法执行就可以解决了。我重新装了一个虚拟机,是centos7,执行安装发现解决了之前遇到的问题,但是6.5版本的没有测,不知道可不可以。

 

[[email protected] share]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm 
warning: mysql57-community-release-el7-11.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-11 ################################# [100%]
[[email protected] share]#  yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks
mysql-connectors-community                               | 2.5 kB     00:00     
mysql-tools-community                                    | 2.5 kB     00:00     
mysql57-community                                        | 2.5 kB     00:00     
(1/3): mysql-connectors-community/x86_64/primary_db        |  14 kB   00:00     
(2/3): mysql57-community/x86_64/primary_db                 | 106 kB   00:00     
(3/3): mysql-tools-community/x86_64/primary_db             |  33 kB   00:01     
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.btte.net
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el7 for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.18-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.18-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.18-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch    Version          Repository          Size
================================================================================
Installing:
 mysql-community-libs         x86_64  5.7.18-1.el7     mysql57-community  2.1 M
     replacing  mariadb-libs.x86_64 1:5.5.52-1.el7
 mysql-community-libs-compat  x86_64  5.7.18-1.el7     mysql57-community  2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.52-1.el7
 mysql-community-server       x86_64  5.7.18-1.el7     mysql57-community  162 M
Installing for dependencies:
 mysql-community-client       x86_64  5.7.18-1.el7     mysql57-community   24 M
 mysql-community-common       x86_64  5.7.18-1.el7     mysql57-community  271 k

Transaction Summary
================================================================================
Install  3 Packages (+2 Dependent packages)

Total download size: 190 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.7.18-1.el7.x86_64.rpm is not installed
(1/5): mysql-community-common-5.7.18-1.el7.x86_64.rpm      | 271 kB   00:02     
(2/5): mysql-community-libs-5.7.18-1.el7.x86_64.rpm        | 2.1 MB   00:07     
(3/5): mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm | 2.0 MB   00:10     
(4/5): mysql-community-client-5.7.18-1.el7.x86_64.rpm      |  24 MB   01:47     
(5/5): mysql-community-server-5.7.18-1.el7.x86_64.rpm      | 162 MB   11:53     
--------------------------------------------------------------------------------
Total                                              265 kB/s | 190 MB  12:15     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <[email protected]>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.18-1.el7.x86_64                   1/6 
  Installing : mysql-community-libs-5.7.18-1.el7.x86_64                     2/6 
  Installing : mysql-community-client-5.7.18-1.el7.x86_64                   3/6 
  Installing : mysql-community-server-5.7.18-1.el7.x86_64                   4/6 
  Installing : mysql-community-libs-compat-5.7.18-1.el7.x86_64              5/6 
  Erasing    : 1:mariadb-libs-5.5.52-1.el7.x86_64                           6/6 
  Verifying  : mysql-community-server-5.7.18-1.el7.x86_64                   1/6 
  Verifying  : mysql-community-common-5.7.18-1.el7.x86_64                   2/6 
  Verifying  : mysql-community-client-5.7.18-1.el7.x86_64                   3/6 
  Verifying  : mysql-community-libs-compat-5.7.18-1.el7.x86_64              4/6 
  Verifying  : mysql-community-libs-5.7.18-1.el7.x86_64                     5/6 
  Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                           6/6 

Installed:
  mysql-community-libs.x86_64 0:5.7.18-1.el7                                    
  mysql-community-libs-compat.x86_64 0:5.7.18-1.el7                             
  mysql-community-server.x86_64 0:5.7.18-1.el7                                  

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.18-1.el7                                  
  mysql-community-common.x86_64 0:5.7.18-1.el7                                  

Replaced:
  mariadb-libs.x86_64 1:5.5.52-1.el7                                            

Complete!

 

以上是关于Centos7 安装 mysql5.7的主要内容,如果未能解决你的问题,请参考以下文章

MySql之centos7.2安装mysql5.7.13

centos7.2安装mysql5.7.13及ssl主从复制

centos7安装mysql5.7步骤(图解版)

centos7安装mysql5.7步骤(图解版)

CentOS7安装MYSQL5.7

CentOS7安装MySQL5.7操作说明