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内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

(0)
上一篇 2022年7月1日
下一篇 2022年7月1日

相关推荐