安装Mysql报错:软件包:mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community) 需要:mysql-community解决

报错信息:

...
错误:软件包:mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
          需要:mysql-community-common(x86-64) = 5.7.30-1.el7
          已安装: mysql-community-common-8.0.20-1.el7.x86_64 (@mysql80-community)
          ...

安装过程:

[root@test2 ~]# wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm    //安装Mysql Yum源

[root@test2 ~]# ls mysql57-community-release-el7-11.noarch.rpm 
mysql57-community-release-el7-11.noarch.rpm

[root@test2 ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql57-community-release-el7-11 ################################# [100%]

[root@test2 ~]# ls /etc/yum.repos.d/mysql-*       //安装Mysql Yum源软件包后会有两个Yum源配置文件
/etc/yum.repos.d/mysql-community.repo  /etc/yum.repos.d/mysql-community-source.repo

[root@test2 ~]# vim /etc/yum.repos.d/mysql-community.repo      //查看Mysql Yum源配置文件
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Enable to use MySQL 5.5
[mysql55-community]
...(以下配置包括mysql-community-source.repo配置文件中enabled=0,都不启用)


[root@test2 ~]# yum -y install mysql-server
...
--> 解决依赖关系完成
错误:软件包:mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
          需要:mysql-community-common(x86-64) = 5.7.30-1.el7
          已安装: mysql-community-common-8.0.20-1.el7.x86_64 (@mysql80-community)
              mysql-community-common(x86-64) = 8.0.20-1.el7
          可用: mysql-community-common-5.7.9-1.el7.x86_64 (mysql57-community)
              mysql-community-common(x86-64) = 5.7.9-1.el7
          可用: mysql-community-common-5.7.10-1.el7.x86_64 (mysql57-community)
              mysql-community-common(x86-64) = 5.7.10-1.el7
          可用: mysql-community-common-5.7.11-1.el7.x86_64 (mysql57-community)
              mysql-community-common(x86-64) = 5.7.11-1.el7
          ...

解决方法:

[root@test2 ~]# yum list installed     //查看现在安装了哪些软件
......
mesa-libGL.x86_64                                               18.3.4-6.el7_7                                       @updates
mesa-libgbm.x86_64                                              18.3.4-6.el7_7                                       @updates
mesa-libglapi.x86_64                                            18.3.4-6.el7_7                                       @updates
microcode_ctl.x86_64                                            2:2.1-29.el7                                         @anaconda
mozjs17.x86_64                                                  17.0.0-20.el7                                        @anaconda
mpfr.x86_64                                                     3.1.1-4.el7                                          @base
-mysql-community-common.x86_64                                   8.0.20-1.el7                                         @mysql80-community
-mysql-community-libs.x86_64                                     8.0.20-1.el7                                         @mysql80-community
mysql-community-libs-compat.x86_64                              5.7.29-1.el7                                         @mysql57-community
mysql57-community-release.noarch                                el7-11                                               installed
ncurses.x86_64                                                  5.9-14.20130511.el7_4                                @anaconda
......
           //可以在上面安装记录中看到已经安装了mysql8.0的相关软件包,需要卸载
     
[root@test2 ~]# yum remove mysql-community-common.x86_64
...
Running transaction
  正在删除    : 2:postfix-2.10.1-7.el7.x86_64                                                                                           1/6
  正在删除    : percona-xtrabackup-24-2.4.20-1.el7.x86_64                                                                               2/6
  正在删除    : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                       3/6
  正在删除    : mysql-community-libs-compat-5.7.29-1.el7.x86_64                                                                         4/6
  正在删除    : mysql-community-libs-8.0.20-1.el7.x86_64                                                                                5/6
  正在删除    : mysql-community-common-8.0.20-1.el7.x86_64
...
删除:
  mysql-community-common.x86_64 0:8.0.20-1.el7

作为依赖被删除:
  mysql-community-libs.x86_64 0:8.0.20-1.el7 mysql-community-libs-compat.x86_64 0:5.7.29-1.el7 percona-xtrabackup-24.x86_64 0:2.4.20-1.el7
  perl-DBD-MySQL.x86_64 0:4.023-6.el7        postfix.x86_64 2:2.10.1-7.el7

完毕!

[root@test2 ~]# yum -y install mysql-server         //重新安装Mysql5.7
...
已安装:
  mysql-community-server.x86_64 0:5.7.30-1.el7

作为依赖被安装:
  mysql-community-client.x86_64 0:5.7.30-1.el7   mysql-community-common.x86_64 0:5.7.30-1.el7   mysql-community-libs.x86_64 0:5.7.30-1.el7

完毕!

[root@test2 ~]# systemctl start mysqld

[root@test2 ~]# systemctl enable mysqld

[root@test2 ~]# ss -antulpo | grep :3306
tcp    LISTEN     0      80       :::3306                 :::*                   users:(("mysqld",pid=2003,fd=21))

 报错解决,可以看到现在Myslq 5.7服务已经成功安装并且启动。

 

上一篇:Access导出到Excel方法汇总


下一篇:CentOS7.X yum安装MySQL8.0