centos7安装mysql5.7的踩坑记录

 更新时间:2022年05月01日 11:39:40   作者:青林一散修  
最近在做项目中发现CentOS 7下升级MySQL5.7的一个坑,所以下面这篇文章主要给大家介绍了关于centos7安装mysql5.7的踩坑记录,文中通过示例代码介绍的非常详细,需要的朋友可以参考下

今天使用centos7进行mysql5.7的安装,出现挫折,记录如下:

下载安装mysql

下载rpm安装包

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
--2022-01-22 03:01:53--  http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm [following]
--2022-01-22 03:01:54--  https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm [following]
--2022-01-22 03:01:55--  https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.36.253.13
Connecting to repo.mysql.com (repo.mysql.com)|23.36.253.13|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9116 (8.9K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-8.noarch.rpm'
 
100%[=========================================================================================================================================================================>] 9,116       --.-K/s   in 0s      
 
2022-01-22 03:01:55 (249 MB/s) - ‘mysql57-community-release-el7-8.noarch.rpm' saved [9116/9116]

安装

yum localinstall mysql57-community-release-el7-8.noarch.rpm
(py3) [root@localhost opt]# yum localinstall mysql57-community-release-el7-8.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining mysql57-community-release-el7-8.noarch.rpm: mysql57-community-release-el7-8.noarch
Marking mysql57-community-release-el7-8.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-8 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===================================================================================================================================================================================================================
 Package                                                  Arch                                  Version                               Repository                                                              Size
===================================================================================================================================================================================================================
Installing:
 mysql57-community-release                                noarch                                el7-8                                 /mysql57-community-release-el7-8.noarch                                8.2 k
 
Transaction Summary
===================================================================================================================================================================================================================
Install  1 Package
 
Total size: 8.2 k
Installed size: 8.2 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql57-community-release-el7-8.noarch                                                                                                                                                          1/1 
  Verifying  : mysql57-community-release-el7-8.noarch                                                                                                                                                          1/1 
 
Installed:
  mysql57-community-release.noarch 0:el7-8                                                                                                                                                                         
 
Complete!

查看安装情况

(py3) [root@localhost opt]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64       MySQL Connectors Community           167
mysql-tools-community/x86_64            MySQL Tools Community                 82
mysql57-community/x86_64                MySQL 5.7 Community Server           564

安装server

yum -y install mysql-community-server
(py3) [root@localhost opt]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.37-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.37-1.el7 for package: mysql-community-server-5.7.37-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.37-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.37-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.37-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.37-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.37-1.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===================================================================================================================================================================================================================
 Package                                                   Arch                                      Version                                            Repository                                            Size
===================================================================================================================================================================================================================
Installing:
 mysql-community-server                                    x86_64                                    5.7.37-1.el7                                       mysql57-community                                    174 M
Installing for dependencies:
 mysql-community-client                                    x86_64                                    5.7.37-1.el7                                       mysql57-community                                     25 M
 mysql-community-common                                    x86_64                                    5.7.37-1.el7                                       mysql57-community                                    311 k
 mysql-community-libs                                      x86_64                                    5.7.37-1.el7                                       mysql57-community                                    2.4 M
 
Transaction Summary
===================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)
 
Total download size: 202 M
Installed size: 878 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.37-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY               ]  0.0 B/s | 767 kB  --:--:-- ETA 
Public key for mysql-community-common-5.7.37-1.el7.x86_64.rpm is not installed
(1/4): mysql-community-common-5.7.37-1.el7.x86_64.rpm                                                                                                                                       | 311 kB  00:00:00     
(2/4): mysql-community-libs-5.7.37-1.el7.x86_64.rpm                                                                                                                                         | 2.4 MB  00:00:04     
(3/4): mysql-community-client-5.7.37-1.el7.x86_64.rpm                                                                                                                                       |  25 MB  00:01:01     
(4/4): mysql-community-server-5.7.37-1.el7.x86_64.rpm                                                                                                                                       | 174 MB  00:03:40     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                              917 kB/s | 202 MB  00:03:45     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-8.noarch (@/mysql57-community-release-el7-8.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
 
Public key for mysql-community-server-5.7.37-1.el7.x86_64.rpm is not installed
 
 
 Failing package is: mysql-community-server-5.7.37-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

这里发现这个问题:

Public key for mysql-community-server-5.7.37-1.el7.x86_64.rpm is not installed
 
 Failing package is: mysql-community-server-5.7.37-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

备注:

由于MySQL在CentOS7中收费了,所以已经不支持MySQL了,取而代之在CentOS7内部集成了mariadb,而安装MySQL的话会和MariaDB的文件冲突。

如果安装的话,需要卸载MariaDB,另外也注意安装正确的安装包,以及安装顺序,建议参考我的另外一篇文章。

总结

到此这篇关于centos7安装mysql5.7踩坑的文章就介绍到这了,更多相关centos7安装mysql5.7内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • MySQL数据库添加外键的四种方式

    MySQL数据库添加外键的四种方式

    这篇文章主要介绍了ysql数据库添加外键的四种方式, 建表时直接使用FOREIGN KEY,建表时使用CONSTRAINT,在建表以后使用ALTER语句以及 使用第三方工具这四种方式,需要的朋友可以参考下
    2024-03-03
  • 你有没有遗忘mysql的历史记录

    你有没有遗忘mysql的历史记录

    程序出现了问题,明知道可能是sql语句造成的,但是因为框架的原因,分析起来十分麻烦,于是打算直接查看数据库里面的历史记录.
    2014-09-09
  • Mysql查询语句详细总结大全

    Mysql查询语句详细总结大全

    这篇文章主要给大家介绍了关于Mysql查询语句详细总结的相关资料,MySQL是一种关系型数据库管理系统,它支持SQL语言进行数据查询,文中通过代码介绍的非常详细,需要的朋友可以参考下
    2023-12-12
  • Mysql 主从数据库同步(centos篇)

    Mysql 主从数据库同步(centos篇)

    Mysql 主从数据库同步(centos篇),需要的朋友可以参考下。
    2011-05-05
  • MySQL关闭密码强度验证功能

    MySQL关闭密码强度验证功能

    本文通过实例代码给大家介绍了mysql关闭密码强度验证功能,非常不错,具有参考借鉴价值,需要的朋友参考下吧
    2017-06-06
  • 浅谈Using filesort和Using temporary 为什么这么慢

    浅谈Using filesort和Using temporary 为什么这么慢

    本文主要介绍了Using filesort和Using temporary为什么这么慢,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-02-02
  • MySQL之主键索引排序失效问题

    MySQL之主键索引排序失效问题

    这篇文章主要介绍了MySQL之主键索引排序失效问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-12-12
  • MSSQL根据ID进行分页实现方法

    MSSQL根据ID进行分页实现方法

    本文将详细介绍MSSQL根据ID进行分页实现方法,需要的朋友可以参考下
    2012-11-11
  • MYSQL导入导出命令详解

    MYSQL导入导出命令详解

    网上看了一些总结出来的资料,不知道对大家有没有用的,有用的话也就不枉费我一按按钮的一片苦心了
    2007-09-09
  • Truncate Table的用法讲解

    Truncate Table的用法讲解

    今天小编就为大家分享一篇关于Truncate Table的用法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-04-04

最新评论