CentOS7如何使用yum安装Mysql5.7

CentOS7安装Mysql5.7时遇到了一些坑,特此记录。

开始正题

第一步

假设你也用的阿里云,那么首先需要下载yum源。

1
wget http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm

下载完成后安装

1
yum localinstall mysql57-community-release-el6-9.noarch.rpm

安装完成后得到

mysql-community.repo
mysql-community-source.repo
两个文件。

到此yum源下载完成, 开始安装。

1
yum install mysql-community-server

第二步

很不幸,出现错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el6 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.7.18-1.el6 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos 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.el6 will be obsoleting
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be updated
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be an update
Removing mariadb-libs.x86_64 1:5.5.52-1.el7 - u due to obsoletes from mysql-community-libs.x86_64 0:5.7.18-1.el6 - u
base/7/x86_64/filelists_db | 6.6 MB 00:01
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be an update
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 2:postfix-2.10.1-6.el7.x86_64 (@anaconda)
Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
Removing: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (@anaconda)
libmysqlclient.so.18(libmysqlclient_18)(64bit)
Obsoleted By: mysql-community-libs-5.7.18-1.el6.x86_64 (mysql57-community)
Not found
Updated By: 1:mariadb-libs-5.5.52-1.el7.x86_64 (base)
libmysqlclient.so.18(libmysqlclient_18)(64bit)
Error: Package: 2:postfix-2.10.1-6.el7.x86_64 (@anaconda)
Requires: libmysqlclient.so.18()(64bit)
Removing: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (@anaconda)
libmysqlclient.so.18()(64bit)
Obsoleted By: mysql-community-libs-5.7.18-1.el6.x86_64 (mysql57-community)
~libmysqlclient.so.20()(64bit)
Updated By: 1:mariadb-libs-5.5.52-1.el7.x86_64 (base)
libmysqlclient.so.18()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

研究老半天后发现是包依赖冲突了,删除mysql的依赖即可。

1
yum remove mysql-libs

再次尝试安装即可成功

1
yum install mysql-community-server
文章目录
  1. 1. 开始正题
    1. 1.1. 第一步
    2. 1.2. 第二步
,