【MySQL入门指北】第二篇 MySQL安装



一、安装MySQL前的准备工作

1.关闭防火墙和selinux

相关指令:

命令作用
systemctl stop firewalld立刻停止防火墙
systemctl disable firewalld开机禁用防火墙
setenforce 0立刻停止selinux
#vim /etc/selinux/config 编辑SELINUX=disabled立刻禁用selinux
在这里插入图片描述

在这里插入图片描述

二、MySQL相关下载地址

我们可以在MySQL官网下载或者其他镜像站下载,自行选择一种即可;
MySQL官网地址:https://www.mysql.com/
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

点击【复制下载地址】
在这里插入图片描述

在这里插入图片描述

国内镜像站:中国科学技术大学开源软件镜像、阿里、腾讯、163(网易)等镜像站
以中国科学技术大学开源软件镜像为例
中国科学技术大学开源软件镜像网址:http://mirrors.ustc.edu.cn/
在这里插入图片描述
在这里插入图片描述

三、安装步骤

1.下载软件包

wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm

在这里插入图片描述
右键点击【复制下载链接】
在这里插入图片描述
在这里插入图片描述
其他几个rpm包操作一样

wget mysql80-community-release-el7-5.noarch.rpm
在这里插入图片描述

wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-community-common-8.0.26-1.el7.x86_64.rpm

在这里插入图片描述

wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-community-server-8.0.26-1.el7.x86_64.rpm

在这里插入图片描述

wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm

在这里插入图片描述

在这里插入图片描述

2.安装相关依赖软件

[root@guan~]#yum install -y net-tools.x86_64 libaio.x86_64 perl.x86_64

在这里插入图片描述

3.安装MySQL服务器

安装所有的mysql-community开头的rpm包
root@guan~]#yum install -y mysql-community*
tips:报错信息:哪里有错误信息就删除了在重新安装

在这里插入图片描述

4.启动MySQL服务器

[root@guan~]#systemctl start mysqld
[root@guan~]#systemctl enable mysqld
[root@guan~]#systemctl status mysqld

在这里插入图片描述

5.查询MySQL服务器默认密码

[root@guan~]#grep ‘password’ /var/log/mysqld.log
2022-04-26T05:13:51.056458Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: F1y%WI*Gm2ee(冒号和空格后面的,全是密码)

在这里插入图片描述

6.修改MySQL服务器密码

[root@guan~]#mysqladmin -uroot -p’默认密码’ password ‘新密码’
在这里插入图片描述

7.用新密码登录MySQL系统

[root@guan~]#mysql -u root -p’Guan123@yuting’
在这里插入图片描述

8.查到默认数据库

[root@guan~]#show databases;
在这里插入图片描述
退出MySQL
在这里插入图片描述

9.关机快照

目的是防止我们在虚拟机把MySQL玩坏了,避免重新安装这麻烦的过程,我们只需要点击快照恢复到MySQL最初安装的那步;
在这里插入图片描述

四、下载MySQL5.7版本

我们可以在MySQL官网下载或者其他镜像站下载,自行选择一种即可;
MySQL官网地址:https://www.mysql.com/
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

点击【复制下载地址】
在这里插入图片描述

在这里插入图片描述
下载完成
在这里插入图片描述
或者使用xshell将下载的rpm包通过rz命令上传到Linux中
在这里插入图片描述

[root@web001 ~]# yum install -y mysql80-community-release-el7-7.noarch.rpm 
已加载插件:fastestmirror
正在检查 mysql80-community-release-el7-7.noarch.rpm: mysql80-community-release-el7-7.noarch
mysql80-community-release-el7-7.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql80-community-release.noarch.0.el7-7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===========================================================================================================
 Package                        架构        版本        源                                            大小
===========================================================================================================
正在安装:
 mysql80-community-release      noarch      el7-7       /mysql80-community-release-el7-7.noarch       10 k

事务概要
===========================================================================================================
安装  1 软件包

总计:10 k
安装大小:10 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql80-community-release-el7-7.noarch                                                 1/1 
  验证中      : mysql80-community-release-el7-7.noarch                                                 1/1 

已安装:
  mysql80-community-release.noarch 0:el7-7                                                                 

完毕!
[root@web001 ~]# ls /etc/yum.repos.d
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo               mysql-community.repo
CentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repo       mysql-community-source.repo#源码包
CentOS-Debuginfo.repo  CentOS-Sources.repo    mysql-community-debuginfo.repo  zabbix.repo

安装mysql5.7版本(默认安装mysql8.0)

[root@mysql ~]# yum list |grep mysql
mysql80-community-release.noarch          el7-7                        @/mysql80-community-release-el7-7.noarch
rh-php72-php-mysqlnd.x86_64               7.2.24-1.el7                 @centos-sclo-rh
zabbix-proxy-mysql.x86_64                 5.0.28-1.el7                 @zabbix  
zabbix-server-mysql.x86_64                5.0.28-1.el7                 @zabbix  
zabbix-web-mysql-scl.noarch               5.0.28-1.el7                 @zabbix-frontend
akonadi-mysql.x86_64                      1.9.2-4.el7                  base     
apr-util-mysql.x86_64                     1.5.2-6.el7                  base     
dovecot-mysql.x86_64                      1:2.2.36-8.el7               base     
freeradius-mysql.x86_64                   3.0.13-15.el7                base     
libdbi-dbd-mysql.x86_64                   0.8.3-16.el7                 base     
mysql-community-client.i686               8.0.31-1.el7                 mysql80-community
mysql-community-client.x86_64             8.0.31-1.el7                 mysql80-community
mysql-community-client-plugins.i686       8.0.31-1.el7                 mysql80-community
mysql-community-client-plugins.x86_64     8.0.31-1.el7                 mysql80-community
mysql-community-common.i686               8.0.31-1.el7                 mysql80-community
mysql-community-common.x86_64             8.0.31-1.el7                 mysql80-community
mysql-community-devel.i686                8.0.31-1.el7                 mysql80-community
mysql-community-devel.x86_64              8.0.31-1.el7                 mysql80-community
mysql-community-embedded-compat.i686      8.0.31-1.el7                 mysql80-community
mysql-community-embedded-compat.x86_64    8.0.31-1.el7                 mysql80-community
mysql-community-icu-data-files.i686       8.0.31-1.el7                 mysql80-community
mysql-community-icu-data-files.x86_64     8.0.31-1.el7                 mysql80-community
mysql-community-libs.i686                 8.0.31-1.el7                 mysql80-community
mysql-community-libs.x86_64               8.0.31-1.el7                 mysql80-community
mysql-community-libs-compat.i686          8.0.31-1.el7                 mysql80-community
mysql-community-libs-compat.x86_64        8.0.31-1.el7                 mysql80-community
mysql-community-release.noarch            el7-5                        mysql-connectors-community
mysql-community-server.x86_64             8.0.31-1.el7                 mysql80-community
mysql-community-server-debug.x86_64       8.0.31-1.el7                 mysql80-community
mysql-community-test.x86_64               8.0.31-1.el7                 mysql80-community
mysql-connector-c++.x86_64                8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-devel.x86_64          8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-jdbc.x86_64           8.0.31-1.el7                 mysql-connectors-community
mysql-connector-j.noarch                  1:8.0.31-1.el7               mysql-connectors-community
mysql-connector-java.noarch               1:8.0.30-1.el7               mysql-connectors-community
mysql-connector-odbc.x86_64               8.0.31-1.el7                 mysql-connectors-community
mysql-connector-odbc-setup.x86_64         8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python.noarch             2.0.4-1.el7                  mysql-connectors-community
mysql-connector-python.x86_64             8.0.23-1.el7                 mysql-connectors-community
mysql-connector-python-cext.x86_64        8.0.21-1.el7                 mysql-connectors-community
mysql-connector-python3.x86_64            8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python3-cext.x86_64       8.0.21-1.el7                 mysql-connectors-community
mysql-ref-manual-8.0-en-html-chapter.noarch
                                          1-20220914                   mysql80-community
mysql-ref-manual-8.0-en-pdf.noarch        1-20220914                   mysql80-community
mysql-router.x86_64                       8.0.12-1.el7                 mysql-tools-community
mysql-router-community.x86_64             8.0.31-1.el7                 mysql-tools-community
mysql-shell.x86_64                        8.0.31-1.el7                 mysql-tools-community
mysql-utilities.noarch                    1.6.5-1.el7                  mysql-tools-community
mysql-utilities-extra.noarch              1.5.6-1.el7                  mysql-tools-community
mysql-workbench-community.x86_64          8.0.22-1.el7                 mysql-tools-community
pcp-pmda-mysql.x86_64                     4.3.2-13.el7_9               updates  
php-mysql.x86_64                          5.4.16-48.el7                base     
php-mysqlnd.x86_64                        5.4.16-48.el7                base     
qt-mysql.i686                             1:4.8.7-9.el7_9              updates  
qt-mysql.x86_64                           1:4.8.7-9.el7_9              updates  
qt5-qtbase-mysql.i686                     5.9.7-5.el7_9                updates  
qt5-qtbase-mysql.x86_64                   5.9.7-5.el7_9                updates  
redland-mysql.x86_64                      1.0.16-6.el7                 base     
rsyslog-mysql.x86_64                      8.24.0-57.el7_9.3            updates  
zabbix-web-mysql-scl-php73.noarch         5.0.28-1.el7                 zabbix2  

在这里插入图片描述
打开mysql的仓库修改自己需要的版本,这只enabled=1为开启&

[root@mysql ~]# vim /etc/yum.repos.d/mysql-community.repo

在这里插入图片描述
刷新缓存

[root@mysql ~]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
base                                                                        | 3.6 kB  00:00:00     
extras                                                                      | 2.9 kB  00:00:00     
mysql-connectors-community                                                  | 2.6 kB  00:00:00     
mysql-tools-community                                                       | 2.6 kB  00:00:00     
mysql57-community                                                           | 2.6 kB  00:00:00     
updates                                                                     | 2.9 kB  00:00:00     
zabbix                                                                      | 2.9 kB  00:00:00     
zabbix2                                                                     | 2.9 kB  00:00:00     
(1/5): mysql-connectors-community/x86_64/other_db                           |  24 kB  00:00:00     
(2/5): mysql-tools-community/x86_64/other_db                                |  17 kB  00:00:00     
(3/5): mysql-connectors-community/x86_64/filelists_db                       |  38 kB  00:00:00     
(4/5): mysql-tools-community/x86_64/filelists_db                            | 393 kB  00:00:00     
(5/5): mysql57-community/x86_64/filelists_db                                | 1.9 MB  00:00:00     
元数据缓存已建立

[root@mysql ~]# yum list |grep mysql
mysql80-community-release.noarch          el7-7                        @/mysql80-community-release-el7-7.noarch
rh-php72-php-mysqlnd.x86_64               7.2.24-1.el7                 @centos-sclo-rh
zabbix-proxy-mysql.x86_64                 5.0.28-1.el7                 @zabbix  
zabbix-server-mysql.x86_64                5.0.28-1.el7                 @zabbix  
zabbix-web-mysql-scl.noarch               5.0.28-1.el7                 @zabbix-frontend
akonadi-mysql.x86_64                      1.9.2-4.el7                  base     
apr-util-mysql.x86_64                     1.5.2-6.el7                  base     
dovecot-mysql.x86_64                      1:2.2.36-8.el7               base     
freeradius-mysql.x86_64                   3.0.13-15.el7                base     
libdbi-dbd-mysql.x86_64                   0.8.3-16.el7                 base     
mysql-community-client.i686               5.7.40-1.el7                 mysql57-community
mysql-community-client.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-common.i686               5.7.40-1.el7                 mysql57-community
mysql-community-common.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-devel.i686                5.7.40-1.el7                 mysql57-community
mysql-community-devel.x86_64              5.7.40-1.el7                 mysql57-community
mysql-community-embedded.i686             5.7.40-1.el7                 mysql57-community
mysql-community-embedded.x86_64           5.7.40-1.el7                 mysql57-community
mysql-community-embedded-compat.i686      5.7.40-1.el7                 mysql57-community
mysql-community-embedded-compat.x86_64    5.7.40-1.el7                 mysql57-community
mysql-community-embedded-devel.i686       5.7.40-1.el7                 mysql57-community
mysql-community-embedded-devel.x86_64     5.7.40-1.el7                 mysql57-community
mysql-community-libs.i686                 5.7.40-1.el7                 mysql57-community
mysql-community-libs.x86_64               5.7.40-1.el7                 mysql57-community
mysql-community-libs-compat.i686          5.7.40-1.el7                 mysql57-community
mysql-community-libs-compat.x86_64        5.7.40-1.el7                 mysql57-community
mysql-community-release.noarch            el7-5                        mysql-connectors-community
mysql-community-server.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-test.x86_64               5.7.40-1.el7                 mysql57-community
mysql-connector-c++.x86_64                8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-devel.x86_64          8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-jdbc.x86_64           8.0.31-1.el7                 mysql-connectors-community
mysql-connector-j.noarch                  1:8.0.31-1.el7               mysql-connectors-community
mysql-connector-java.noarch               1:8.0.30-1.el7               mysql-connectors-community
mysql-connector-odbc.x86_64               8.0.31-1.el7                 mysql-connectors-community
mysql-connector-odbc-setup.x86_64         8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python.noarch             2.0.4-1.el7                  mysql-connectors-community
mysql-connector-python.x86_64             8.0.23-1.el7                 mysql-connectors-community
mysql-connector-python-cext.x86_64        8.0.21-1.el7                 mysql-connectors-community
mysql-connector-python3.x86_64            8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python3-cext.x86_64       8.0.21-1.el7                 mysql-connectors-community
mysql-ref-manual-5.5-en-html-chapter.noarch
                                          1-20170320                   mysql57-community
mysql-ref-manual-5.5-en-pdf.noarch        1-20170320                   mysql57-community
mysql-ref-manual-5.7-en-html-chapter.noarch
                                          1-20220831                   mysql57-community
mysql-ref-manual-5.7-en-pdf.noarch        1-20220831                   mysql57-community
mysql-router.x86_64                       8.0.12-1.el7                 mysql-tools-community
mysql-router-community.x86_64             8.0.31-1.el7                 mysql-tools-community
mysql-shell.x86_64                        8.0.31-1.el7                 mysql-tools-community
mysql-utilities.noarch                    1.6.5-1.el7                  mysql-tools-community
mysql-utilities-extra.noarch              1.5.6-1.el7                  mysql-tools-community
mysql-workbench-community.x86_64          8.0.22-1.el7                 mysql-tools-community
pcp-pmda-mysql.x86_64                     4.3.2-13.el7_9               updates  
php-mysql.x86_64                          5.4.16-48.el7                base     
php-mysqlnd.x86_64                        5.4.16-48.el7                base     
qt-mysql.i686                             1:4.8.7-9.el7_9              updates  
qt-mysql.x86_64                           1:4.8.7-9.el7_9              updates  
qt5-qtbase-mysql.i686                     5.9.7-5.el7_9                updates  
qt5-qtbase-mysql.x86_64                   5.9.7-5.el7_9                updates  
redland-mysql.x86_64                      1.0.16-6.el7                 base     
rsyslog-mysql.x86_64                      8.24.0-57.el7_9.3            updates  
zabbix-web-mysql-scl-php73.noarch         5.0.28-1.el7                 zabbix2  

上面操作完成即可看到mysql-server 由原来的mysql8.0变为msyql5.7版本
在这里插入图片描述
安装mysql

[root@mysql ~]# yum install -y mysql-community*  
//或者yum install  mysql-server 会自动安装mysql服务的相关依赖组件
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-compat.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-release.noarch.0.el7-5 将被 安装
---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-test.x86_64.0.5.7.40-1.el7 将被 安装
--> 正在处理依赖关系 perl(JSON),它被软件包 mysql-community-test-5.7.40-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-JSON.noarch.0.2.59-2.el7 将被 安装
--> 处理 mysql80-community-release-el7-7.noarch 与 mysql-community-release 的冲突
--> 解决依赖关系完成
错误:mysql80-community-release conflicts with mysql-community-release-el7-5.noarch
 您可以尝试添加 --skip-broken 选项来解决该问题
 您可以尝试执行:rpm -Va --nofiles --nodigest
[root@mysql ~]# yum install -y mysql-community* --skip-broken
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-compat.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-release.noarch.0.el7-5 将被 安装
---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-test.x86_64.0.5.7.40-1.el7 将被 安装
--> 正在处理依赖关系 perl(JSON),它被软件包 mysql-community-test-5.7.40-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-JSON.noarch.0.2.59-2.el7 将被 安装
--> 处理 mysql80-community-release-el7-7.noarch 与 mysql-community-release 的冲突
--> 正在检查事务
---> 软件包 mysql-community-release.noarch.0.el7-5 将被 安装
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-compat.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-embedded-devel.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 mysql-community-test.x86_64.0.5.7.40-1.el7 将被 安装
---> 软件包 perl-JSON.noarch.0.2.59-2.el7 将被 安装
--> 解决依赖关系完成

因为依赖关系问题而跳过的软件包:
    mysql-community-release-el7-5.noarch 来自 mysql-connectors-community

依赖关系解决

===================================================================================================
 Package                            架构      版本             源                             大小
===================================================================================================
正在安装:
 mysql-community-client             x86_64    5.7.40-1.el7     mysql57-community              28 M
      替换  mariadb.x86_64 1:5.5.68-1.el7
 mysql-community-common             x86_64    5.7.40-1.el7     mysql57-community             311 k
 mysql-community-devel              x86_64    5.7.40-1.el7     mysql57-community             4.2 M
 mysql-community-embedded           x86_64    5.7.40-1.el7     mysql57-community              46 M
 mysql-community-embedded-compat    x86_64    5.7.40-1.el7     mysql57-community              22 M
 mysql-community-embedded-devel     x86_64    5.7.40-1.el7     mysql57-community             127 M
 mysql-community-libs               x86_64    5.7.40-1.el7     mysql57-community             2.6 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat        x86_64    5.7.40-1.el7     mysql57-community             1.2 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server             x86_64    5.7.40-1.el7     mysql57-community             178 M
      替换  mariadb-server.x86_64 1:5.5.68-1.el7
 mysql-community-test               x86_64    5.7.40-1.el7     mysql57-community             121 M
为依赖而安装:
 perl-JSON                          noarch    2.59-2.el7       base                           96 k
跳过(依赖问题):
 mysql-community-release            noarch    el7-5            mysql-connectors-community    6.0 k

事务概要
===================================================================================================
安装              10 软件包 (+1 依赖软件包)
跳过(依赖问题)   1 软件包

总下载量:532 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
mysql-community-common-5.7.40-1.el7.x86_64.rpm 的公钥尚未安装
(1/11): mysql-community-common-5.7.40-1.el7.x86_64.rpm                      | 311 kB  00:00:00     
(2/11): mysql-community-devel-5.7.40-1.el7.x86_64.rpm                       | 4.2 MB  00:00:00     
(3/11): mysql-community-client-5.7.40-1.el7.x86_64.rpm                      |  28 MB  00:00:01     
(4/11): mysql-community-embedded-5.7.40-1.el7.x86_64.rpm                    |  46 MB  00:00:02     
(5/11): mysql-community-embedded-compat-5.7.40-1.el7.x86_64.rpm             |  22 MB  00:00:03     
(6/11): mysql-community-libs-5.7.40-1.el7.x86_64.rpm                        | 2.6 MB  00:00:00     
(7/11): mysql-community-libs-compat-5.7.40-1.el7.x86_64.rpm                 | 1.2 MB  00:00:00     
(8/11): mysql-community-embedded-devel-5.7.40-1.el7.x86_64.rpm              | 127 MB  00:00:06     
(9/11): perl-JSON-2.59-2.el7.noarch.rpm                                     |  96 kB  00:00:00     
(10/11): mysql-community-test-5.7.40-1.el7.x86_64.rpm                       | 121 MB  00:00:08     
(11/11): mysql-community-server-5.7.40-1.el7.x86_64.rpm                     | 178 MB  00:00:13     
---------------------------------------------------------------------------------------------------
总计                                                                27 MB/s | 532 MB  00:00:19     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022 检索密钥
导入 GPG key 0x3A79BD29:
 用户ID     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 指纹       : 859b e8d7 c586 f538 430b 19c2 467b 942d 3a79 bd29
 软件包     : mysql80-community-release-el7-7.noarch (@/mysql80-community-release-el7-7.noarch)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
 用户ID     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 指纹       : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 软件包     : mysql80-community-release-el7-7.noarch (@/mysql80-community-release-el7-7.noarch)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql-community-common-5.7.40-1.el7.x86_64                                    1/14 
  正在安装    : mysql-community-libs-5.7.40-1.el7.x86_64                                      2/14 
  正在安装    : mysql-community-client-5.7.40-1.el7.x86_64                                    3/14 
  正在安装    : mysql-community-server-5.7.40-1.el7.x86_64                                    4/14 
  正在安装    : mysql-community-devel-5.7.40-1.el7.x86_64                                     5/14 
  正在安装    : mysql-community-embedded-5.7.40-1.el7.x86_64                                  6/14 
  正在安装    : perl-JSON-2.59-2.el7.noarch                                                   7/14 
  正在安装    : mysql-community-test-5.7.40-1.el7.x86_64                                      8/14 
  正在安装    : mysql-community-embedded-devel-5.7.40-1.el7.x86_64                            9/14 
  正在安装    : mysql-community-libs-compat-5.7.40-1.el7.x86_64                              10/14 
  正在安装    : mysql-community-embedded-compat-5.7.40-1.el7.x86_64                          11/14 
  正在删除    : 1:mariadb-server-5.5.68-1.el7.x86_64                                         12/14 
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
  正在删除    : 1:mariadb-5.5.68-1.el7.x86_64                                                13/14 
  正在删除    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                           14/14 
  验证中      : mysql-community-client-5.7.40-1.el7.x86_64                                    1/14 
  验证中      : mysql-community-devel-5.7.40-1.el7.x86_64                                     2/14 
  验证中      : mysql-community-server-5.7.40-1.el7.x86_64                                    3/14 
  验证中      : mysql-community-common-5.7.40-1.el7.x86_64                                    4/14 
  验证中      : mysql-community-embedded-compat-5.7.40-1.el7.x86_64                           5/14 
  验证中      : mysql-community-libs-compat-5.7.40-1.el7.x86_64                               6/14 
  验证中      : mysql-community-libs-5.7.40-1.el7.x86_64                                      7/14 
  验证中      : perl-JSON-2.59-2.el7.noarch                                                   8/14 
  验证中      : mysql-community-embedded-5.7.40-1.el7.x86_64                                  9/14 
  验证中      : mysql-community-test-5.7.40-1.el7.x86_64                                     10/14 
  验证中      : mysql-community-embedded-devel-5.7.40-1.el7.x86_64                           11/14 
  验证中      : 1:mariadb-server-5.5.68-1.el7.x86_64                                         12/14 
  验证中      : 1:mariadb-5.5.68-1.el7.x86_64                                                13/14 
  验证中      : 1:mariadb-libs-5.5.68-1.el7.x86_64                                           14/14 

已安装:
  mysql-community-client.x86_64 0:5.7.40-1.el7                                                     
  mysql-community-common.x86_64 0:5.7.40-1.el7                                                     
  mysql-community-devel.x86_64 0:5.7.40-1.el7                                                      
  mysql-community-embedded.x86_64 0:5.7.40-1.el7                                                   
  mysql-community-embedded-compat.x86_64 0:5.7.40-1.el7                                            
  mysql-community-embedded-devel.x86_64 0:5.7.40-1.el7                                             
  mysql-community-libs.x86_64 0:5.7.40-1.el7                                                       
  mysql-community-libs-compat.x86_64 0:5.7.40-1.el7                                                
  mysql-community-server.x86_64 0:5.7.40-1.el7                                                     
  mysql-community-test.x86_64 0:5.7.40-1.el7                                                       

作为依赖被安装:
  perl-JSON.noarch 0:2.59-2.el7                                                                    

跳过(依赖问题):
  mysql-community-release.noarch 0:el7-5                                                           

替代:
  mariadb.x86_64 1:5.5.68-1.el7                     mariadb-libs.x86_64 1:5.5.68-1.el7             
  mariadb-server.x86_64 1:5.5.68-1.el7             

完毕!

查询MySQL服务器默认密码

root@guan~]#grep 'password' /var/log/mysqld.log
2022-04-17T03:39:40.521811Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9-Q10DnGxFQr
#冒号和空格后面的,全是密码

修改MySQL服务器密码

[root@mysql~]#mysqladmin  -uroot  -p'默认密码'  password  '新密码'

登录MySQL系统

mysql  -u root -p'123456'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 95
Server version: 5.7.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



查到默认数据库

mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.04 sec)

mysql> 

五、源码安装

安装编译软件

[root@mysql01 ~]#  yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make cmake
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 ncurses-5.9-14.20130511.el7_4.x86_64 已安装并且是最新版本
软件包 1:openssl-devel-1.0.2k-25.el7_9.x86_64 已安装并且是最新版本
软件包 gcc-4.8.5-44.el7.x86_64 已安装并且是最新版本
软件包 gcc-c++-4.8.5-44.el7.x86_64 已安装并且是最新版本
软件包 1:make-3.82-24.el7.x86_64 已安装并且是最新版本
软件包 cmake-2.8.12.2-2.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 bison.x86_64.0.3.0.4-2.el7 将被 安装
---> 软件包 ncurses-devel.x86_64.0.5.9-14.20130511.el7_4 将被 安装
--> 解决依赖关系完成

依赖关系解决

===================================================================================================
 Package                  架构              版本                             源               大小
===================================================================================================
正在安装:
 bison                    x86_64            3.0.4-2.el7                      base            674 k
 ncurses-devel            x86_64            5.9-14.20130511.el7_4            base            712 k

事务概要
===================================================================================================
安装  2 软件包

总下载量:1.4 M
安装大小:4.2 M
Downloading packages:
No Presto metadata available for base
(1/2): ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm                       | 712 kB  00:00:04     
(2/2): bison-3.0.4-2.el7.x86_64.rpm                                         | 674 kB  00:00:04     
---------------------------------------------------------------------------------------------------
总计                                                               330 kB/s | 1.4 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                     1/2 
  正在安装    : bison-3.0.4-2.el7.x86_64                                                       2/2 
  验证中      : bison-3.0.4-2.el7.x86_64                                                       1/2 
  验证中      : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                     2/2 

已安装:
  bison.x86_64 0:3.0.4-2.el7              ncurses-devel.x86_64 0:5.9-14.20130511.el7_4             

完毕!

准备源码包

[root@mysql01# rz #上传boost_1_59_0.tar.gz

[root@mysql01 ~]# rz  #上传mysql-5.7.19.tar.gz  

[root@mysql01 ~]# ls
anaconda-ks.cfg       mysql-5.7.19.tar.gz                         公共  图片  音乐
boost_1_59_0.tar.gz   mysql80-community-release-el7-7.noarch.rpm  模板  文档  桌面
initial-setup-ks.cfg  zabbix                                      视频  下载
[root@mysql01 ~]# ll
总用量 132252
-rw-------. 1 root root     1523 417 2022 anaconda-ks.cfg
-rw-r--r--  1 root root 83709983 112 01:07 boost_1_59_0.tar.gz
-rw-r--r--. 1 root root     1571 417 2022 initial-setup-ks.cfg
-rw-r--r--  1 root root 51686763 112 00:58 mysql-5.7.19.tar.gz
-rw-r--r--  1 root root    11196 1031 01:28 mysql80-community-release-el7-7.noarch.rpm
drwxr-xr-x  2 root root        6 107 21:53 zabbix
drwxr-xr-x. 2 root root        6 822 05:21 公共
drwxr-xr-x. 2 root root        6 822 05:21 模板
drwxr-xr-x. 2 root root        6 822 05:21 视频
drwxr-xr-x. 2 root root        6 822 05:21 图片
drwxr-xr-x. 2 root root        6 822 05:21 文档
drwxr-xr-x. 2 root root        6 822 05:21 下载
drwxr-xr-x. 2 root root        6 822 05:21 音乐
drwxr-xr-x. 4 root root     4096 1029 11:22 桌面

安装MySQL,增添一个mysql账号

 [root@mysql01 ~]#groupadd mysql
 [root@mysql ~]#useradd -r -g mysql -s /bin/false mysql

解压压缩包

 [root@mysql01 ~]#tar xvf mysql-5.7.19.tar.gz
 [root@mysql01 ~]#cd mysql-5.7.19
 [root@mysql01 mysql-5.7.19]# pwd
/root/mysql-5.7.19
 [root@mysql01 mysql-5.7.19]#mv ../boost_1_59_0.tar.gz  .
 [root@mysql01 mysql-5.7.19]# tar xf  boost_1_59_0.tar.gz

配置

[root@mysql01 mysql-5.7.19]#cmake . \
-DWITH_BOOST=boost_1_59_0/ \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1

编译

[root@mysql01 mysql-5.7.19]#make  #慢长的等待
....
Linking CXX executable my_safe_process
[100%] Built target my_safe_process

安装

[root@mysql01 mysql-5.7.19]#make install

初始化

[root@localhost mysql-5.7.19]#  cd /usr/local/mysql
[root@localhost mysql]# mkdir mysql-files
[root@localhost mysql]# chown -R msyql.mysql /usr/local/mysql
chown: 无效的用户: "msyql.mysql"
[root@localhost mysql]# chown -R mysql.mysql /usr/local/mysql
[root@localhost mysql]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2022-11-02T15:54:56.903996Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-11-02T15:54:56.904222Z 0 [ERROR] Can't find error-message file '--basedir=/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2022-11-02T15:54:57.288176Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-11-02T15:54:57.374078Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-11-02T15:54:57.433245Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b32b399a-5ac6-11ed-a1ee-000c295a3e87.
2022-11-02T15:54:57.434217Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-11-02T15:54:57.590240Z 0 [Warning] CA certificate ca.pem is self signed.
2022-11-02T15:54:57.620503Z 1 [Note] A temporary password is generated for root@localhost: FWeZdIHSp8#y

在这里插入图片描述

[root@localhost mysql]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
[root@localhost mysql]# mv /etc/my.cnf  ~
[root@localhost mysql]# vim /etc/my.cnf
[root@localhost mysql]# cat /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

#将support-files/mysql.server 复制添加到开机自启动目录/etc/init.d/mysqld下
[root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld     
[root@localhost mysql]# chkconfig --add mysqld   #添加mysql服务
[root@localhost mysql]# chkconfig mysqld on    #开机自动启动mysql服务
[root@localhost mysql]# service mysqld start
Starting MySQL.Logging to '/usr/local/mysql/data/web001.err'.
 SUCCESS! 
[root@localhost mysql]# ps aux |grep mysqld
root       9287  0.0  0.0  11824  1600 pts/0    S    00:15   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/web001.pid
mysql      9399  1.3  9.3 1154576 174456 pts/0  Sl   00:15   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=web001.err --pid-file=/usr/local/mysql/data/web001.pid
root       9444  0.0  0.0 112824   980 pts/0    R+   00:16   0:00 grep --color=auto mysqld
[root@localhost mysql]# mysql -u root -p'FWeZdIHSp8#y'
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[root@localhost mysql]# /usr/local/mysql/bin/mysql -uroot -p'FWeZdIHSp8#y'  #登录数据库
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> quit;
Bye

[root@localhost mysql]# /usr/local/mysql/bin/mysqladmin -uroot -p'FWeZdIHSp8#y' password '123456'  #配置新密码
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
[root@localhost mysql]# /usr/local/mysql/bin/mysql -uroot -p'123456'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.19 Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> 

六、自建MySQL的YUM服务器

准备两台虚拟机

mysql-servermysql-agent
192.168.200.183192.168.200.182

进行mysql-server端的配置
1.安装FTP

[root@mysql-server ~]# systemctl status msyql
Unit msyql.service could not be found.
[root@mysql-server ~]# yum install -y vsftpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                 | 3.6 kB  00:00:00     
extras                                                                               | 2.9 kB  00:00:00     
updates                                                                              | 2.9 kB  00:00:00     
zabbix                                                                               | 2.9 kB  00:00:00     
zabbix2                                                                              | 2.9 kB  00:00:00     
(1/2): zabbix2/primary_db                                                            |  62 kB  00:00:03     
(2/2): zabbix/primary_db                                                             | 192 kB  00:00:04     
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-29.el7_9 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package                架构                   版本                           源                       大小
============================================================================================================
正在安装:
 vsftpd                 x86_64                 3.0.2-29.el7_9                 updates                 173 k

事务概要
============================================================================================================
安装  1 软件包

总下载量:173 k
安装大小:353 k
Downloading packages:
vsftpd-3.0.2-29.el7_9.x86_64.rpm                                                     | 173 kB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : vsftpd-3.0.2-29.el7_9.x86_64                                                            1/1 
  验证中      : vsftpd-3.0.2-29.el7_9.x86_64                                                            1/1 

已安装:
  vsftpd.x86_64 0:3.0.2-29.el7_9                                                                            

完毕!






2.准备ftp主目录

[root@mysql-server ~]# mkdir /var/ftp/mysql57/

3.官网下载yum仓库的包

[root@mysql-server ~]# ls
anaconda-ks.cfg                              yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm  视频  音乐
initial-setup-ks.cfg                         zabbix                                             图片  桌面
yum-3.4.3-132.el7.centos.0.1.noarch.rpm      公共                                               文档
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  模板                                               下载
[root@mysql-server ~]# cd 桌面
[root@mysql-server ~]# ls
nginx-1.22.0         VMwareTools-10.3.10-13959562.tar.gz  yum-3.4.3-168.el7.centos.noarch.rpm          yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm  zabbix-release-4.0-2.el7.noarch.rpm
nginx-1.22.0.tar.gz  vmware-tools-distrib                 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  zabbix-6.0.9.tar.gz                                  zabbix.shell
[root@mysql-server  桌面]# ls
mysql80-community-release-el7-7.noarch.rpm  yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
nginx-1.22.0                                yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
nginx-1.22.0.tar.gz                         zabbix-6.0.9.tar.gz
VMwareTools-10.3.10-13959562.tar.gz         zabbix-release-4.0-2.el7.noarch.rpm
vmware-tools-distrib                        zabbix.shell
yum-3.4.3-168.el7.centos.noarch.rpm
[root@mysql-server  桌面]# cp mysql80-community-release-el7-7.noarch.rpm /root
[root@mysql-server  桌面]# cd
[root@mysql-server  ~]# ls
anaconda-ks.cfg                             yum-metadata-parser-1.1.4-10.el7.x86_64.rpm        模板  下载
initial-setup-ks.cfg                        yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm  视频  音乐
mysql80-community-release-el7-7.noarch.rpm  zabbix                                             图片  桌面
yum-3.4.3-132.el7.centos.0.1.noarch.rpm     公共                                               文档
[root@mysql-server ~]# yum install -y mysql80-community-release-el7-7.noarch.rpm
已加载插件:fastestmirror
正在检查 mysql80-community-release-el7-7.noarch.rpm: mysql80-community-release-el7-7.noarch
mysql80-community-release-el7-7.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql80-community-release.noarch.0.el7-7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package                        架构        版本         源                                            大小
============================================================================================================
正在安装:
 mysql80-community-release      noarch      el7-7        /mysql80-community-release-el7-7.noarch       10 k

事务概要
============================================================================================================
安装  1 软件包

总计:10 k
安装大小:10 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql80-community-release-el7-7.noarch                                                  1/1 
  验证中      : mysql80-community-release-el7-7.noarch                                                  1/1 

已安装:
  mysql80-community-release.noarch 0:el7-7                                                                  

完毕!
[root@mysql-server  ~]# ls /etc/yum.repos.d
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo               mysql-community.repo
CentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repo       mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo    mysql-community-debuginfo.repo  zabbix.repo
#因为我要安装msyql57,所以将MYSQL80关闭,开启MySQL57
[root@mysql-server  ~]# vim  /etc/yum.repos.d/mysql-community.repo
[root@mysql-server ~]# cat /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

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

[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-2022
       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-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

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

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

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

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


4.仅下载不安装mysql

[root@mysql-server  ~]# yum list |grep mysql
mysql80-community-release.noarch          el7-7                        @/mysql80-community-release-el7-7.noarch
rh-php72-php-mysqlnd.x86_64               7.2.24-1.el7                 @centos-sclo-rh
zabbix-proxy-mysql.x86_64                 5.0.28-1.el7                 @zabbix  
zabbix-server-mysql.x86_64                5.0.28-1.el7                 @zabbix  
zabbix-web-mysql-scl.noarch               5.0.28-1.el7                 @zabbix-frontend
akonadi-mysql.x86_64                      1.9.2-4.el7                  base     
apr-util-mysql.x86_64                     1.5.2-6.el7                  base     
dovecot-mysql.x86_64                      1:2.2.36-8.el7               base     
freeradius-mysql.x86_64                   3.0.13-15.el7                base     
libdbi-dbd-mysql.x86_64                   0.8.3-16.el7                 base     
mysql-community-client.i686               5.7.40-1.el7                 mysql57-community
mysql-community-client.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-common.i686               5.7.40-1.el7                 mysql57-community
mysql-community-common.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-devel.i686                5.7.40-1.el7                 mysql57-community
mysql-community-devel.x86_64              5.7.40-1.el7                 mysql57-community
mysql-community-embedded.i686             5.7.40-1.el7                 mysql57-community
mysql-community-embedded.x86_64           5.7.40-1.el7                 mysql57-community
mysql-community-embedded-compat.i686      5.7.40-1.el7                 mysql57-community
mysql-community-embedded-compat.x86_64    5.7.40-1.el7                 mysql57-community
mysql-community-embedded-devel.i686       5.7.40-1.el7                 mysql57-community
mysql-community-embedded-devel.x86_64     5.7.40-1.el7                 mysql57-community
mysql-community-libs.i686                 5.7.40-1.el7                 mysql57-community
mysql-community-libs.x86_64               5.7.40-1.el7                 mysql57-community
mysql-community-libs-compat.i686          5.7.40-1.el7                 mysql57-community
mysql-community-libs-compat.x86_64        5.7.40-1.el7                 mysql57-community
mysql-community-release.noarch            el7-5                        mysql-connectors-community
mysql-community-server.x86_64             5.7.40-1.el7                 mysql57-community
mysql-community-test.x86_64               5.7.40-1.el7                 mysql57-community
mysql-connector-c++.x86_64                8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-devel.x86_64          8.0.31-1.el7                 mysql-connectors-community
mysql-connector-c++-jdbc.x86_64           8.0.31-1.el7                 mysql-connectors-community
mysql-connector-j.noarch                  1:8.0.31-1.el7               mysql-connectors-community
mysql-connector-java.noarch               1:8.0.30-1.el7               mysql-connectors-community
mysql-connector-odbc.x86_64               8.0.31-1.el7                 mysql-connectors-community
mysql-connector-odbc-setup.x86_64         8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python.noarch             2.0.4-1.el7                  mysql-connectors-community
mysql-connector-python.x86_64             8.0.23-1.el7                 mysql-connectors-community
mysql-connector-python-cext.x86_64        8.0.21-1.el7                 mysql-connectors-community
mysql-connector-python3.x86_64            8.0.31-1.el7                 mysql-connectors-community
mysql-connector-python3-cext.x86_64       8.0.21-1.el7                 mysql-connectors-community
mysql-ref-manual-5.5-en-html-chapter.noarch
                                          1-20170320                   mysql57-community
mysql-ref-manual-5.5-en-pdf.noarch        1-20170320                   mysql57-community
mysql-ref-manual-5.7-en-html-chapter.noarch
                                          1-20220831                   mysql57-community
mysql-ref-manual-5.7-en-pdf.noarch        1-20220831                   mysql57-community
mysql-router.x86_64                       8.0.12-1.el7                 mysql-tools-community
mysql-router-community.x86_64             8.0.31-1.el7                 mysql-tools-community
mysql-shell.x86_64                        8.0.31-1.el7                 mysql-tools-community
mysql-utilities.noarch                    1.6.5-1.el7                  mysql-tools-community
mysql-utilities-extra.noarch              1.5.6-1.el7                  mysql-tools-community
mysql-workbench-community.x86_64          8.0.22-1.el7                 mysql-tools-community
pcp-pmda-mysql.x86_64                     4.3.2-13.el7_9               updates  
php-mysql.x86_64                          5.4.16-48.el7                base     
php-mysqlnd.x86_64                        5.4.16-48.el7                base     
qt-mysql.i686                             1:4.8.7-9.el7_9              updates  
qt-mysql.x86_64                           1:4.8.7-9.el7_9              updates  
qt5-qtbase-mysql.i686                     5.9.7-5.el7_9                updates  
qt5-qtbase-mysql.x86_64                   5.9.7-5.el7_9                updates  
redland-mysql.x86_64                      1.0.16-6.el7                 base     
rsyslog-mysql.x86_64                      8.24.0-57.el7_9.3            updates  
zabbix-proxy-mysql.x86_64                 5.0.29-1.el7                 zabbix   
zabbix-server-mysql.x86_64                5.0.29-1.el7                 zabbix   
zabbix-web-mysql-scl.noarch               5.0.29-1.el7                 zabbix2  
zabbix-web-mysql-scl-php73.noarch         5.0.29-1.el7                 zabbix2  
[root@mysql-server  ~]# yum install -y --downloadonly  mysql-community-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.40-1.el7,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.40-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 perl-DBD-MySQL-4.023-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 zabbix-server-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 zabbix-proxy-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 perl-DBD-MySQL-4.023-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 zabbix-server-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 zabbix-proxy-mysql-5.0.28-1.el7.x86_64 需要
---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 zabbix-proxy-mysql.x86_64.0.5.0.28-1.el7 将被 升级
---> 软件包 zabbix-proxy-mysql.x86_64.0.5.0.29-1.el7 将被 更新
---> 软件包 zabbix-server-mysql.x86_64.0.5.0.28-1.el7 将被 升级
---> 软件包 zabbix-server-mysql.x86_64.0.5.0.29-1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package                             架构           版本                    源                         大小
============================================================================================================
正在安装:
 mysql-community-client              x86_64         5.7.40-1.el7            mysql57-community          28 M
      替换  mariadb.x86_64 1:5.5.68-1.el7
 mysql-community-libs                x86_64         5.7.40-1.el7            mysql57-community         2.6 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat         x86_64         5.7.40-1.el7            mysql57-community         1.2 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server              x86_64         5.7.40-1.el7            mysql57-community         178 M
      替换  mariadb-server.x86_64 1:5.5.68-1.el7
为依赖而安装:
 mysql-community-common              x86_64         5.7.40-1.el7            mysql57-community         311 k
为依赖而更新:
 zabbix-proxy-mysql                  x86_64         5.0.29-1.el7            zabbix                    1.1 M
 zabbix-server-mysql                 x86_64         5.0.29-1.el7            zabbix                    3.1 M

事务概要
============================================================================================================
安装  4 软件包 (+1 依赖软件包)
升级           ( 2 依赖软件包)

总下载量:215 M
Background downloading packages, then exiting:
No Presto metadata available for zabbix
警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
mysql-community-common-5.7.40-1.el7.x86_64.rpm 的公钥尚未安装
(1/7): mysql-community-common-5.7.40-1.el7.x86_64.rpm                                | 311 kB  00:00:03     
(2/7): mysql-community-libs-5.7.40-1.el7.x86_64.rpm                                  | 2.6 MB  00:00:07     
(3/7): mysql-community-libs-compat-5.7.40-1.el7.x86_64.rpm                           | 1.2 MB  00:00:03     
(4/7): zabbix-proxy-mysql-5.0.29-1.el7.x86_64.rpm                                    | 1.1 MB  00:00:23     
(5/7): zabbix-server-mysql-5.0.29-1.el7.x86_64.rpm                                   | 3.1 MB  00:00:28     
(6/7): mysql-community-client-5.7.40-1.el7.x86_64.rpm                                |  28 MB  00:01:50     
(7/7): mysql-community-server-5.7.40-1.el7.x86_64.rpm                                | 178 MB  00:07:39     
------------------------------------------------------------------------------------------------------------
总计                                                                        465 kB/s | 215 MB  00:07:53     
exiting because "Download Only" specified

5.查找下载的mysql安装包

[root@mysql-server  ~]# mkdir /var/ftp/mysql57/
[root@mysql-server  ~]# ls /etc/yum.repos.d
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo               mysql-community.repo
CentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repo       mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo    mysql-community-debuginfo.repo  zabbix.repo
[root@mysql-server  ~]#find /var/cache/yum/x86_64/7/ -iname "*.rpm" -exec cp -rf {} /var/ftp/mysql57 \;
[root@mysql-server  ~]# cd /var/cache/yum/x86_64/7/
[root@mysql-server 7]# ls
base              extras                      timedhosts      zabbix
centos-sclo-rh    mysql57-community           timedhosts.txt  zabbix2
centos-sclo-sclo  mysql-connectors-community  updates         zabbix-frontend
epel              mysql-tools-community       webtatic        zabbix-non-supported
[root@mysql-server 7]# cd /var/ftp/mysql57
[root@mysql-server mysql57]# ls
mysql-community-client-5.7.40-1.el7.x86_64.rpm       mysql-community-server-5.7.40-1.el7.x86_64.rpm
mysql-community-common-5.7.40-1.el7.x86_64.rpm       zabbix-proxy-mysql-5.0.29-1.el7.x86_64.rpm
mysql-community-libs-5.7.40-1.el7.x86_64.rpm         zabbix-server-mysql-5.0.29-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.40-1.el7.x86_64.rpm

6.创建依赖关系



[root@mysql-server mysql57]# yum provides  createrepo
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
createrepo-0.9.9-28.el7.noarch : Creates a common metadata repository
源    :base



createrepo-0.9.9-28.el7.noarch : Creates a common metadata repository
源    :@anaconda



[root@mysql-server mysql57]# createrepo /var/ftp/mysql57/
Spawning worker 0 with 7 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

7.FTP启动


[root@mysql-server mysql57]# systemctl start vsftpd
[root@mysql-server mysql57]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since 五 2022-11-04 01:01:17 CST; 7s ago
  Process: 119177 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 119178 (vsftpd)
    Tasks: 1
   CGroup: /system.slice/vsftpd.service
           └─119178 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

11月 04 01:01:17 web001 systemd[1]: Starting Vsftpd ftp daemon...
11月 04 01:01:17 web001 systemd[1]: Started Vsftpd ftp daemon.

[root@mysql-server mysql57]# vim /etc/yum.repos.d/mysql57.repo

8.自建YUM仓库

[root@mysql-server mysql57]# vim /etc/yum.repos.d/mysql57.repo

在这里插入图片描述


进行mysql-agent的配置

[root@mysql-agent ~]# cd /etc/yum.repos.d
[root@mysql-agent yum.repos.d]# ls
CentOS-Base.repo  CentOS-Base.repo.bak  epel.repo  epel-testing.repo  zabbix.repo
[root@mysql-agent yum.repos.d]# vim /etc/yum.repos.d/mysql57.repo
[root@mysql-agent yum.repos.d]# cat mysql57.repo
[mysql57]
name=guanguan
baseurl=ftp://192.168.200.183/mysql57
gpgcheck=0
enabled=1


[root@zabbix-agent yum.repos.d]# yum makecache 
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                        | 3.6 kB  00:00:00     
epel                                                                                                                                                                                        | 4.7 kB  00:00:00     
extras                                                                                                                                                                                      | 2.9 kB  00:00:00     
mysql57                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                     | 2.9 kB  00:00:00     
zabbix                                                                                                                                                                                      | 2.9 kB  00:00:00     
zabbix-frontend                                                                                                                                                                             | 2.9 kB  00:00:00     
zabbix-non-supported                                                                                                                                                                        | 2.9 kB  00:00:00     
(1/18): epel/x86_64/group_gz                                                                                                                                                                |  98 kB  00:00:03     
epel/x86_64/updateinfo         FAILED                                                       8% [=======                                                                          ] 197 kB/s | 4.6 MB  00:04:07 ETA 
http://mirrors.aliyun.com/epel/7/x86_64/repodata/e17e9e5f344047189cc9d0d8f3b397bb6a1ad597bf98882664876ed33c5e641d-updateinfo.xml.bz2: [Errno 12] Timeout on http://mirrors.aliyun.com/epel/7/x86_64/repodata/e17e9e5f344047189cc9d0d8f3b397bb6a1ad597bf98882664876ed33c5e641d-updateinfo.xml.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
(2/18): epel/x86_64/prestodelta                                                                                                                                                             |  726 B  00:00:00     
(3/18): epel/x86_64/filelists_db                                                                                                                                                            |  12 MB  00:01:25     
(4/18): epel/x86_64/primary_db                                                                                                                                                              | 7.0 MB  00:00:38     
(5/18): mysql57/filelists_db                                                                                                                                                                | 4.8 kB  00:00:00     
(6/18): mysql57/other_db                                                                                                                                                                    | 3.3 kB  00:00:00     
(7/18): mysql57/primary_db                                                                                                                                                                  |  10 kB  00:00:00     
(8/18): epel/x86_64/other_db                                                                                                                                                                | 3.4 MB  00:00:30     
(9/18): updates/7/x86_64/filelists_db                                                                                                                                                       | 9.6 MB  00:01:15     
(10/18): zabbix/x86_64/filelists_db                                                                                                                                                         |  67 kB  00:00:04     
(11/18): zabbix/x86_64/primary_db                                                                                                                                                           | 192 kB  00:00:05     
(12/18): zabbix-frontend/x86_64/primary_db                                                                                                                                                  |  62 kB  00:00:01     
(13/18): updates/7/x86_64/other_db                                                                                                                                                          | 1.2 MB  00:00:09     
(14/18): zabbix-frontend/x86_64/filelists_db                                                                                                                                                | 120 kB  00:00:05     
(15/18): zabbix/x86_64/other_db                                                                                                                                                             | 320 kB  00:00:05     
(16/18): zabbix-frontend/x86_64/other_db                                                                                                                                                    | 294 kB  00:00:06     
(17/18): epel/x86_64/updateinfo                                                                                                                                                             | 1.0 MB  00:00:05     
(18/18): updates/7/x86_64/primary_db                                                                                                                                                        |  17 MB  00:02:15     
元数据缓存已建立
[root@zabbix-agent yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
源标识                                                                                     源名称                                                                                                            状态
base/7/x86_64                                                                              CentOS-7 - Base - mirrors.aliyun.com                                                                              10,072
epel/x86_64                                                                                Extra Packages for Enterprise Linux 7 - x86_64                                                                    13,734
extras/7/x86_64                                                                            CentOS-7 - Extras - mirrors.aliyun.com                                                                               515
mysql57                                                                                    guanguan                                                                                                               7
updates/7/x86_64                                                                           CentOS-7 - Updates - mirrors.aliyun.com                                                                            4,346
zabbix/x86_64                                                                              Zabbix Official Repository - x86_64                                                                                  332
zabbix-frontend/x86_64                                                                     Zabbix Official Repository frontend - x86_64                                                                         303
zabbix-non-supported/x86_64                                                                Zabbix Official Repository non-supported - x86_64                                                                      5
repolist: 29,314
[root@zabbix-proxy yum.repos.d]# yum list mysql
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
错误:没有匹配的软件包可以列出
[root@zabbix-proxy yum.repos.d]# yum install -y mysql-community-server
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.40-1.el7,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.40-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 perl-DBD-MySQL-4.023-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 zabbix-server-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 zabbix-proxy-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 perl-DBD-MySQL-4.023-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 zabbix-server-mysql-5.0.28-1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 zabbix-proxy-mysql-5.0.28-1.el7.x86_64 需要
---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
---> 软件包 zabbix-proxy-mysql.x86_64.0.5.0.28-1.el7 将被 升级
---> 软件包 zabbix-proxy-mysql.x86_64.0.5.0.29-1.el7 将被 更新
---> 软件包 zabbix-server-mysql.x86_64.0.5.0.28-1.el7 将被 升级
---> 软件包 zabbix-server-mysql.x86_64.0.5.0.29-1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

===================================================================================================================================================================================================================
 Package                                                          架构                                        版本                                              源                                            大小
===================================================================================================================================================================================================================
正在安装:
 mysql-community-client                                           x86_64                                      5.7.40-1.el7                                      mysql57                                       28 M
      替换  mariadb.x86_64 1:5.5.68-1.el7
 mysql-community-libs                                             x86_64                                      5.7.40-1.el7                                      mysql57                                      2.6 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat                                      x86_64                                      5.7.40-1.el7                                      mysql57                                      1.2 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server                                           x86_64                                      5.7.40-1.el7                                      mysql57                                      178 M
      替换  mariadb-server.x86_64 1:5.5.68-1.el7
为依赖而安装:
 mysql-community-common                                           x86_64                                      5.7.40-1.el7                                      mysql57                                      311 k
为依赖而更新:
 zabbix-proxy-mysql                                               x86_64                                      5.0.29-1.el7                                      mysql57                                      1.1 M
 zabbix-server-mysql                                              x86_64                                      5.0.29-1.el7                                      mysql57                                      3.1 M

事务概要
===================================================================================================================================================================================================================
安装  4 软件包 (+1 依赖软件包)
升级           ( 2 依赖软件包)

总下载量:215 M
Downloading packages:
No Presto metadata available for mysql57
(1/7): mysql-community-common-5.7.40-1.el7.x86_64.rpm                                                                                                                                       | 311 kB  00:00:00     
(2/7): mysql-community-libs-5.7.40-1.el7.x86_64.rpm                                                                                                                                         | 2.6 MB  00:00:00     
(3/7): mysql-community-libs-compat-5.7.40-1.el7.x86_64.rpm                                                                                                                                  | 1.2 MB  00:00:00     
(4/7): mysql-community-client-5.7.40-1.el7.x86_64.rpm                                                                                                                                       |  28 MB  00:00:01     
(5/7): zabbix-proxy-mysql-5.0.29-1.el7.x86_64.rpm                                                                                                                                           | 1.1 MB  00:00:00     
(6/7): zabbix-server-mysql-5.0.29-1.el7.x86_64.rpm                                                                                                                                          | 3.1 MB  00:00:00     
(7/7): mysql-community-server-5.7.40-1.el7.x86_64.rpm                                                                                                                                       | 178 MB  00:00:04     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                45 MB/s | 215 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql-community-common-5.7.40-1.el7.x86_64                                                                                                                                                    1/12 
  正在安装    : mysql-community-libs-5.7.40-1.el7.x86_64                                                                                                                                                      2/12 
  正在安装    : mysql-community-libs-compat-5.7.40-1.el7.x86_64                                                                                                                                               3/12 
  正在安装    : mysql-community-client-5.7.40-1.el7.x86_64                                                                                                                                                    4/12 
  正在安装    : mysql-community-server-5.7.40-1.el7.x86_64                                                                                                                                                    5/12 
  正在更新    : zabbix-proxy-mysql-5.0.29-1.el7.x86_64                                                                                                                                                        6/12 
  正在更新    : zabbix-server-mysql-5.0.29-1.el7.x86_64                                                                                                                                                       7/12 
  正在删除    : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                                                                                          8/12 
警告:/var/log/mariadb/mariadb.log 已另存为 /var/log/mariadb/mariadb.log.rpmsave
  正在删除    : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                                 9/12 
  清理        : zabbix-server-mysql-5.0.28-1.el7.x86_64                                                                                                                                                      10/12 
  清理        : zabbix-proxy-mysql-5.0.28-1.el7.x86_64                                                                                                                                                       11/12 
  正在删除    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                           12/12 
  验证中      : mysql-community-client-5.7.40-1.el7.x86_64                                                                                                                                                    1/12 
  验证中      : mysql-community-server-5.7.40-1.el7.x86_64                                                                                                                                                    2/12 
  验证中      : mysql-community-common-5.7.40-1.el7.x86_64                                                                                                                                                    3/12 
  验证中      : mysql-community-libs-5.7.40-1.el7.x86_64                                                                                                                                                      4/12 
  验证中      : mysql-community-libs-compat-5.7.40-1.el7.x86_64                                                                                                                                               5/12 
  验证中      : zabbix-proxy-mysql-5.0.29-1.el7.x86_64                                                                                                                                                        6/12 
  验证中      : zabbix-server-mysql-5.0.29-1.el7.x86_64                                                                                                                                                       7/12 
  验证中      : zabbix-proxy-mysql-5.0.28-1.el7.x86_64                                                                                                                                                        8/12 
  验证中      : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                                                                                          9/12 
  验证中      : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                                10/12 
  验证中      : zabbix-server-mysql-5.0.28-1.el7.x86_64                                                                                                                                                      11/12 
  验证中      : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                           12/12 

已安装:
  mysql-community-client.x86_64 0:5.7.40-1.el7       mysql-community-libs.x86_64 0:5.7.40-1.el7       mysql-community-libs-compat.x86_64 0:5.7.40-1.el7       mysql-community-server.x86_64 0:5.7.40-1.el7      

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

作为依赖被升级:
  zabbix-proxy-mysql.x86_64 0:5.0.29-1.el7                                                                zabbix-server-mysql.x86_64 0:5.0.29-1.el7                                                               

替代:
  mariadb.x86_64 1:5.5.68-1.el7                                     mariadb-libs.x86_64 1:5.5.68-1.el7                                     mariadb-server.x86_64 1:5.5.68-1.el7                                    

完毕!
[root@zabbix-agent yum.repos.d]# systemctl start mysqld
[root@zabbix-agent yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 五 2022-11-04 01:14:09 CST; 9s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 10225 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 10204 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 10228 (mysqld)
    Tasks: 28
   CGroup: /system.slice/mysqld.service
           └─10228 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

11月 04 01:14:05 zabbix-proxy systemd[1]: Starting MySQL Server...
11月 04 01:14:09 zabbix-proxy systemd[1]: Started MySQL Server.

[root@zabbix-proxy yum.repos.d]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 


总结

例如:以上就是今天要讲的内容,本文仅仅简单介绍了MySQL的安装,从而能使我们在虚拟机中安装一个MySQL。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

guan12319

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值