1.配置
系统:centos7.6
mysql版本:mysql 5.7
2.这里原先的方案为:直接卸载mysql
3.遇到的问题:
安装mysql的最后一步时
#yum install mysql-community-server
遇到以下错误:
Error: Package: 2:postfix-2.10.1-7.el7.x86_64 (@anaconda)
Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
Removing: 1:mariadb-libs-5.5.60-1.el7_5.x86_64 (@anaconda)
libmysqlclient.so.18(libmysqlclient_18)(64bit)
Obsoleted By: mysql-community-libs-5.7.29-1.el6.x86_64 (mysql57-community-dmr)
Not found
Updated By: 1:mariadb-libs-5.5.64-1.el7.x86_64 (base)
libmysqlclient.so.18(libmysqlclient_18)(64bit)
Error: Package: 2:postfix-2.10.1-7.el7.x86_64 (@anaconda)
Requires: libmysqlclient.so.18()(64bit)
Removing: 1:mariadb-libs-5.5.60-1.el7_5.x86_64 (@anaconda)
libmysqlclient.so.18()(64bit)
Obsoleted By: mysql-community-libs-5.7.29-1.el6.x86_64 (mysql57-community-dmr)
~libmysqlclient.so.20()(64bit)
Updated By: 1:mariadb-libs-5.5.64-1.el7.x86_64 (base)
libmysqlclient.so.18()(64bit)
Error: Package: mysql-community-server-5.7.29-1.el6.x86_64 (mysql57-community-dmr)
Requires: libsasl2.so.2()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
查询各种信息;基本确定是因为 mysql 的依赖问题。刚开始,最快的解决方案就是卸载重装.
4.解决方法:
卸载,重装了两遍还是出现同样的错误。
提示:
Error: Package: mysql-community-server-5.7.29-1.el6.x86_64 (mysql57-community-dmr)
Requires: libsasl2.so.2()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
最后解决方案:
修改vim /etc/yum.repos.d/mysql-community.repo 源文件
这里注意,禁用mysql其他版本,只启用5.7
更改2点,保存后重新安装
enabled=0
gpgcheck=0
yum install mysql-community-server
以上操作完成后,完美解决
下面来说说如何卸载
4.1.快速删除
yum remove mysql mysql-server mysql-libs mysql-server
4.2.查找残留文件
rpm -qa | grep -i mysql
4.3将查询出来的文件逐个删除,如:
yum remove mysql-community-common-5.7.29-1.el6.x86_64
4.4.查找残留目录
whereis mysql
4.5逐条删除目录,如:
rm –rf /usr/lib64/mysql
####这些操作完成后更新源
5.给CentOS添加rpm源,并且选择较新的源
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm --no-check-certificate
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
yum-config-manager --disable mysql55-community
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
yum repolist enabled | grep mysql
6.查询mysql所用的版本:
yum repolist all | grep mysql
7.检测系统是否存在mysql
yum list installed|grep mysql
8.删除mysql依赖项
yum-yremovemysql-libs.x86_64
9.备注:需要掌握的yum命令
9.1安装yum 仓库列表:
yum -y localinstall mysql57-community-release-el6-8.noarch.rpm
9.2查看:
yum list | grep mysql
9.3安装mysql
yum -y install mysql-community-server
10.如何禁用或启用mysql的其他版本:
方法1:
官网文档上给出的执行命令
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community
方法2:修改配置文件
vi /etc/yum.repos.d/mysql-community.repo
修改完成后再次查看:yum repolist all | grep mysql
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:yum install mysql-community-server错误解决方案 - Python技术站