Cent OS7强制安装Mysql8.0.22的错误解决办法

 

1、安装mysql为什么会出错?

2、正常安装过程和报错示例。

2.1查看系统版本

lsb_release -a

2.2下载mysql安装包

下载地址:https://dev.mysql.com/downloads/mysql/
选择想要下载的mysql版本和对应的系统版本

下载mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar,我下载新版本,找到对应的rpm-bundle.tar安装包下载即可!

2.3、检查是否已经存在mysql,若存在卸载,避免安装时产生一些错误!

rpm -qa | grep -i mysql

若存在,使用rpm -e packname –nodeps命令删除安装包

which mysql

查看mysql配置信息,删除对应的配置文件等信息!

删除mysql用户

userdel mysql

2.4、上传安装包

将下载的安装包上传到相应的目录,我上传至/mysql 目录

mkdir -vp /opt/software/mysql

上传安装包

2.5、解压缩安装包

 tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
[root@bogon mysql]# tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.22-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
mysql-community-common-8.0.22-1.el7.x86_64.rpm
mysql-community-devel-8.0.22-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.22-1.el7.x86_64.rpm
mysql-community-libs-8.0.22-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm
mysql-community-server-8.0.22-1.el7.x86_64.rpm
mysql-community-test-8.0.22-1.el7.x86_64.rpm

2.6创建mysql用户和组

groupadd -g 1001 mysql
useradd mysql -g mysql -p mysql

2.7安装mysql

rpm -ivh MySQL-server-5.6.41-1.el7.x86_64.rpm
警告:mysql-community-server-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-client(x86-64) >= 8.0.11 被 mysql-community-server-8.0.22-1.el7.x86_64 需要
        mysql-community-common(x86-64) = 8.0.22-1.el7 被 mysql-community-server-8.0.22-1.el7.x86_64 需要
        mariadb-server 被 mysql-community-server-8.0.22-1.el7.x86_64 取代
他说这个依赖检测失败,那我先把mariadb-server卸载了再说
rpm -e mariadb-server --nodeps
搞定
[root@bogon mysql]# rpm -ivh mysql-community-server-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-server-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-client(x86-64) >= 8.0.11 被 mysql-community-server-8.0.22-1.el7.x86_64 需要
        mysql-community-common(x86-64) = 8.0.22-1.el7 被 mysql-community-server-8.0.22-1.el7.x86_64 需要
这玩意需要先装这个mysql-community-clientmysql-community-common那咋办,装呗
rpm -ivh MySQL-client-5.6.41-1.el7.x86_64.rpm
[root@bogon mysql]# rpm -ivh mysql-community-client-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-client-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-client-plugins = 8.0.22-1.el7 被 mysql-community-client-8.0.22-1.el7.x86_64 需要
        mysql-community-libs(x86-64) >= 8.0.11 被 mysql-community-client-8.0.22-1.el7.x86_64 需要
        mariadb 被 mysql-community-client-8.0.22-1.el7.x86_64 取代
[root@bogon mysql]# rpm -ivh mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-client-plugins-8.################################# [100%]
[root@bogon mysql]# rpm -ivh mysql-community-libs-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-libs-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-common(x86-64) >= 8.0.11 被 mysql-community-libs-8.0.22-1.el7.x86_64 需要
        mariadb-libs 被 mysql-community-libs-8.0.22-1.el7.x86_64 取代
[root@bogon mysql]# rpm -ivh mysql-community-common-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-common-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-common-8.0.22-1.e################################# [100%]
[root@bogon mysql]# rpm -ivh mysql-community-libs-8.0.22-1.el7.x86_64.rpm
警告:mysql-community-libs-8.0.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mariadb-libs 被 mysql-community-libs-8.0.22-1.el7.x86_64 取代
[root@bogon mysql]# rpm -e mariadb-libs
错误:依赖检测失败:
        libmysqlclient.so.18()(64bit) 被 (已安裝) perl-DBD-MySQL-4.023-6.el7.x86_64 需要
        libmysqlclient.so.18()(64bit) 被 (已安裝) qt-mysql-1:4.8.7-8.el7.x86_64 需要
        libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-9.el7.x86_64 需要
        libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) perl-DBD-MySQL-4.023-6.el7.x86_64 需要
        libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) qt-mysql-1:4.8.7-8.el7.x86_64 需要
        libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-9.el7.x86_64 需要
然后这个错误就开始死循环,反正卸载不了这个 mariadb-libs
rpm -qa |grep -i mysql也没有用

一个命令:yum remove mysql-libs解决

清除之前安装过的依赖即可
rpm -ivh mysql-community-devel-8.0.22-1.el7.x86_64.rpm --force --nodeps

3、报错如何解决?

[root@bogon mysql]# rpm -e mariadb-libs
错误:依赖检测失败:
。。。

yum remove mysql-libs

 

 

 

 

 

附一个比较正常的安装过程

 

https://blog.csdn.net/weixin_40780777/article/details/100553505

成功后查看服务起来

[root@bogon mysql]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2020-11-19 15:02:39 CST; 58s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 12212 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 12289 (mysqld)
   Status: "Server is operational"
    Tasks: 38
   CGroup: /system.slice/mysqld.service
           └─12289 /usr/sbin/mysqld

11月 19 15:02:28 bogon systemd[1]: Starting MySQL Server...
11月 19 15:02:39 bogon systemd[1]: Started MySQL Server.

posted on 2020-11-19 15:07  乾元东  阅读(4895)  评论(0编辑  收藏  举报