CentOS7编译安装MySQL5.7之后安装mysql-devel出错解决方案

 

由于我的MySQL是自己编译安装,但是安装之后/etc/yum.repos.d/目录下并没有MySQL的源,导致我在安装mysql-devel出错。

缺少MySQL的源:

[root@localhost liuyuantao]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo  mongodb-org-3.2.repo

具体错误如下:

[root@localhost liuyuantao]# yum -y install mysql-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cqu.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
Removing mariadb-libs.x86_64 1:5.5.50-1.el7_2 - u due to obsoletes from installed mysql-community-libs-5.7.14-1.el7.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.47-1.el7_2 will be installed
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
Removing mariadb-libs.x86_64 1:5.5.47-1.el7_2 - u due to obsoletes from installed mysql-community-libs-5.7.14-1.el7.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be installed
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
Removing mariadb-libs.x86_64 1:5.5.44-2.el7.centos - u due to obsoletes from installed mysql-community-libs-5.7.14-1.el7.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be installed
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
---> Package mariadb-libs.x86_64 1:5.5.50-1.el7_2 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64
--> Finished Dependency Resolution
Error: Package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64 (updates)
           Requires: libmysqlclient.so.18()(64bit)
           Available: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (base)
               libmysqlclient.so.18()(64bit)
           Available: 1:mariadb-libs-5.5.47-1.el7_2.x86_64 (updates)
               libmysqlclient.so.18()(64bit)
           Available: 1:mariadb-libs-5.5.50-1.el7_2.x86_64 (updates)
               libmysqlclient.so.18()(64bit)
Error: Package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64 (updates)
           Requires: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2
           Available: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (base)
               mariadb-libs(x86-64) = 1:5.5.44-2.el7.centos
           Available: 1:mariadb-libs-5.5.47-1.el7_2.x86_64 (updates)
               mariadb-libs(x86-64) = 1:5.5.47-1.el7_2
           Available: 1:mariadb-libs-5.5.50-1.el7_2.i686 (updates)
              ~mariadb-libs(x86-32) = 1:5.5.50-1.el7_2
Error: Package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64 (updates)
           Requires: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2
           Installing: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (base)
               mariadb-libs(x86-64) = 1:5.5.44-2.el7.centos
           Available: 1:mariadb-libs-5.5.47-1.el7_2.x86_64 (updates)
               mariadb-libs(x86-64) = 1:5.5.47-1.el7_2
           Available: 1:mariadb-libs-5.5.50-1.el7_2.i686 (updates)
              ~mariadb-libs(x86-32) = 1:5.5.50-1.el7_2
Error: Package: 1:mariadb-devel-5.5.50-1.el7_2.x86_64 (updates)
           Requires: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2
           Available: 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 (base)
               mariadb-libs(x86-64) = 1:5.5.44-2.el7.centos
           Installing: 1:mariadb-libs-5.5.47-1.el7_2.x86_64 (updates)
               mariadb-libs(x86-64) = 1:5.5.47-1.el7_2
           Available: 1:mariadb-libs-5.5.50-1.el7_2.i686 (updates)
              ~mariadb-libs(x86-32) = 1:5.5.50-1.el7_2
 You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
icedtea-web-1.6.1-4.el7.x86_64 has missing requires of java-1.8.0-openjdk
jline-1.0-8.el7.noarch has missing requires of java >= ('0', '1.5', None)

上面的错误由于没有MySQL的源,导致在安装mysql-devel的时候会提示安装mariadb-devel-5.5.50-1.el7_2.x86_64,并且系统并没有mysql_config,(缺少mysql_config在安装mysql-python的时候会提示出错,如果出现安装mysql-python错误,请查看CentOS7使用pip安装mysql-python出错解决方案)。

具体解决方案:

1.需要安装MySQL的源

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

2.这是在/etc/yum.repos.d/目录下会出现MySQL的相关repo

[root@localhost tmp]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo     mysql-community.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  mongodb-org-3.2.repo  mysql-community-source.repo

3.现在有MySQL的源,可以安装mysql-devel了

[root@localhost yum.repos.d]# yum install mysql-devel
Loaded plugins: fastestmirror, langpacks
mysql-connectors-community                                                                                                                          | 2.5 kB  00:00:00     
mysql-tools-community                                                                                                                               | 2.5 kB  00:00:00     
mysql57-community                                                                                                                                   | 2.5 kB  00:00:00     
mysql57-community/x86_64/primary_db                                                                                                                 |  76 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.cqu.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-devel.x86_64 0:5.7.15-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                                         Arch                             Version                                Repository                                   Size
===========================================================================================================================================================================
Installing:
 mysql-community-devel                           x86_64                           5.7.15-1.el7                           mysql57-community                           3.6 M

Transaction Summary
===========================================================================================================================================================================
Install  1 Package

Total download size: 3.6 M
Installed size: 21 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-devel-5.7.15-1.el7.x86_64.rpm                                                                                                       | 3.6 MB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
icedtea-web-1.6.1-4.el7.x86_64 has missing requires of java-1.8.0-openjdk
jline-1.0-8.el7.noarch has missing requires of java >= ('0', '1.5', None)
  Installing : mysql-community-devel-5.7.15-1.el7.x86_64                                                                                                               1/1 
  Verifying  : mysql-community-devel-5.7.15-1.el7.x86_64                                                                                                               1/1 

Installed:
  mysql-community-devel.x86_64 0:5.7.15-1.el7                                                                                                                              

Complete!
[root@localhost yum.repos.d]# 

你可能感兴趣的:(#,MySQL,mysql-devel,mysql)