[root@localhost ~]# mkdir /usr/local/mysql5.7
[root@localhost ~]# cd /usr/local/mysql5.7/
[root@localhost mysql5.7]# wget http://dev.mysql.com/get/mysql57-community-relea se-el7-11.noarch.rpm
--2020-12-06 10:04:24-- http://dev.mysql.com/get/mysql57-community-release-el7- 11.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm [跟 随至新的 URL]
--2020-12-06 10:04:28-- https://dev.mysql.com/get/mysql57-community-release-el7 -11.noarch.rpm
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [跟随 至新的 URL]
--2020-12-06 10:04:35-- https://repo.mysql.com//mysql57-community-release-el7-1 1.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 184.26.84.248
正在连接 repo.mysql.com (repo.mysql.com)|184.26.84.248|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:25680 (25K) [application/x-redhat-package-manager]
正在保存至: “mysql57-community-release-el7-11.noarch.rpm”
100%[======================================>] 25,680 79.7KB/s 用时 0.3s
2020-12-06 10:04:44 (79.7 KB/s) - 已保存 “mysql57-community-release-el7-11.noarc h.rpm” [25680/25680])
[root@localhost mysql5.7]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
警告:mysql57-community-release-el7-11.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql57-community-release-el7-11 ################################# [100%]
[root@localhost mysql5.7]# yum install mysql-community-server
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 5.8 kB 00:00
* base: mirrors.bfsu.edu.cn
* centos-sclo-rh: mirror.bit.edu.cn
* centos-sclo-sclo: mirror.bit.edu.cn
* epel: mirrors.bfsu.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
base | 3.6 kB 00:00
centos-sclo-rh | 3.0 kB 00:00
centos-sclo-sclo | 3.0 kB 00:00
docker-ce-stable | 3.5 kB 00:00
epel | 4.7 kB 00:00
extras | 2.9 kB 00:00
google-chrome | 1.3 kB 00:00
mysql-connectors-community | 2.6 kB 00:00
mysql-tools-community | 2.6 kB 00:00
mysql57-community | 2.6 kB 00:00
updates | 2.9 kB 00:00
(1/2): epel/x86_64/updateinfo | 1.0 MB 00:00
(2/2): epel/x86_64/primary_db | 6.9 MB 00:01
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.7.32-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.32-1.el7,它被软件包 m ysql-community-server-5.7.32-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-c ommunity-server-5.7.32-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.5.7.32-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-com munity-client-5.7.32-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.7.32-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mysql-community-libs.x86_64.0.5.7.32-1.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
mysql-community-server x86_64 5.7.32-1.el7 mysql57-community 173 M
为依赖而安装:
mysql-community-client x86_64 5.7.32-1.el7 mysql57-community 25 M
mysql-community-common x86_64 5.7.32-1.el7 mysql57-community 308 k
mysql-community-libs x86_64 5.7.32-1.el7 mysql57-community 2.3 M
事务概要
================================================================================
安装 1 软件包 (+3 依赖软件包)
总下载量:201 M
安装大小:875 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.32-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
mysql-community-common-5.7.32-1.el7.x86_64.rpm 的公钥尚未安装
(1/4): mysql-community-common-5.7.32-1.el7.x86_64.rpm | 308 kB 00:00:02
(2/4): mysql-community-libs-5.7.32-1.el7.x86_64.rpm | 2.3 MB 00:00:12
(3/4): mysql-community-client-5.7.32-1.el7.x86_64.rpm | 25 MB 00:01:09
(4/4): mysql-community-server-5.7.32-1.el7.x86_64.rpm | 173 MB 00:37:09
----------------------------------------------------------------------------------
总计 92 kB/s | 201 MB 37:24
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
用户ID : "MySQL Release Engineering "
指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
软件包 : mysql57-community-release-el7-11.noarch (installed)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 1 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
icedtea-web-1.7.1-2.el7_6.x86_64 有缺少的需求 java-1.8.0-openjdk
正在安装 : mysql-community-common-5.7.32-1.el7.x86_64 1/4
正在安装 : mysql-community-libs-5.7.32-1.el7.x86_64 2/4
正在安装 : mysql-community-client-5.7.32-1.el7.x86_64 3/4
正在安装 : mysql-community-server-5.7.32-1.el7.x86_64 4/4
验证中 : mysql-community-server-5.7.32-1.el7.x86_64 1/4
验证中 : mysql-community-common-5.7.32-1.el7.x86_64 2/4
验证中 : mysql-community-libs-5.7.32-1.el7.x86_64 3/4
验证中 : mysql-community-client-5.7.32-1.el7.x86_64 4/4
已安装:
mysql-community-server.x86_64 0:5.7.32-1.el7
作为依赖被安装:
mysql-community-client.x86_64 0:5.7.32-1.el7
mysql-community-common.x86_64 0:5.7.32-1.el7
mysql-community-libs.x86_64 0:5.7.32-1.el7
完毕!
[root@localhost mysql5.7]#
[root@localhost ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@localhost ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[root@localhost ~]# mysqld --skip-grant-tables &
[1] 23806
[root@localhost ~]# 2020-12-06T05:15:37.651486Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-12-06T05:15:37.653734Z 0 [Note] mysqld (mysqld 5.7.32) starting as process 23806 ...
2020-12-06T05:15:37.655922Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2020-12-06T05:15:37.655953Z 0 [ERROR] Aborting
2020-12-06T05:15:37.655978Z 0 [Note] Binlog end
2020-12-06T05:15:37.656045Z 0 [Note] mysqld: Shutdown complete