首页 > 数据库技术 > 详细

centos7国内镜像安装最新版mysql

时间:2021-04-24 21:00:35      阅读:36      评论:0      收藏:0      [点我收藏+]

说明:

a.此种方式安装可以利用国内镜像,下载速度快。

b.适合最新版安装

 

1.获取yum安装地址

[root@bigdata-senior02 mysql]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql80-community-release-el7-3.noarch.rpm
--2021-04-24 17:22:21--  https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql80-community-release-el7-3.noarch.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:26024 (25K) [application/x-redhat-package-manager]
正在保存至: “mysql80-community-release-el7-3.noarch.rpm”

100%[=======================================================================================================================================================================>] 26,024      26.9KB/s 用时 0.9s   

2021-04-24 17:22:23 (26.9 KB/s) - 已保存 “mysql80-community-release-el7-3.noarch.rpm” [26024/26024])

[root@bigdata-senior02 mysql]# ls
mysql80-community-release-el7-3.noarch.rpm
[root@bigdata-senior02 mysql]# ll
总用量 28
-rw-r--r--. 1 root root 26024 4月  25 2019 mysql80-community-release-el7-3.noarch.rpm
[root@bigdata-senior02 mysql]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm 
警告:mysql80-community-release-el7-3.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql80-community-release-el7-3  ################################# [100%]

 

2.yum安装

[root@bigdata-senior02 mysql]# yum install mysql-server
已加载插件:fastestmirror, langpacks
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     
mysql80-community                                                                                                                                                                         | 2.6 kB  00:00:00     
updates                                                                                                                                                                                   | 2.9 kB  00:00:00     
(1/3): mysql-connectors-community/x86_64/primary_db                                                                                                                                       |  77 kB  00:00:02     
(2/3): mysql80-community/x86_64/primary_db                                                                                                                                                | 153 kB  00:00:02     
(3/3): mysql-tools-community/x86_64/primary_db                                                                                                                                            |  87 kB  00:00:03     
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.8.0.24-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 8.0.24-1.el7,它被软件包 mysql-community-server-8.0.24-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.11,它被软件包 mysql-community-server-8.0.24-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.8.0.24-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-client-plugins = 8.0.24-1.el7,它被软件包 mysql-community-client-8.0.24-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 8.0.11,它被软件包 mysql-community-client-8.0.24-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.8.0.24-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.24-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.8.0.24-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.24-1.el7 将被 舍弃
---> 软件包 postfix.x86_64.2.2.10.1-6.el7 将被 升级
---> 软件包 postfix.x86_64.2.2.10.1-9.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================================================================================================================
 Package                                                        架构                                   版本                                              源                                                 大小
=================================================================================================================================================================================================================
正在安装:
 mysql-community-libs                                           x86_64                                 8.0.24-1.el7                                      mysql80-community                                 4.0 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat                                    x86_64                                 8.0.24-1.el7                                      mysql80-community                                 1.2 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server                                         x86_64                                 8.0.24-1.el7                                      mysql80-community                                 428 M
为依赖而安装:
 mysql-community-client                                         x86_64                                 8.0.24-1.el7                                      mysql80-community                                  45 M
 mysql-community-client-plugins                                 x86_64                                 8.0.24-1.el7                                      mysql80-community                                 189 k
 mysql-community-common                                         x86_64                                 8.0.24-1.el7                                      mysql80-community                                 614 k
为依赖而更新:
 postfix                                                        x86_64                                 2:2.10.1-9.el7                                    base                                              2.4 M

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

总下载量:482 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
警告:/var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.24-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY              ] 130 kB/s | 150 kB  01:03:19 ETA 
mysql-community-client-plugins-8.0.24-1.el7.x86_64.rpm 的公钥尚未安装
(1/7): mysql-community-client-plugins-8.0.24-1.el7.x86_64.rpm                                                                                                                             | 189 kB  00:00:01     
(2/7): mysql-community-common-8.0.24-1.el7.x86_64.rpm                                                                                                                                     | 614 kB  00:00:01     
(3/7): mysql-community-libs-8.0.24-1.el7.x86_64.rpm                                                                                                                                       | 4.0 MB  00:00:03     
(4/7): mysql-community-libs-compat-8.0.24-1.el7.x86_64.rpm                                                                                                                                | 1.2 MB  00:00:00     
(5/7): postfix-2.10.1-9.el7.x86_64.rpm                                                                                                                                                    | 2.4 MB  00:00:09     
(6/7): mysql-community-client-8.0.24-1.el7.x86_64.rpm                                                                                                                                     |  45 MB  00:02:24     
(7/7): mysql-community-server-8.0.24-1.el7.x86_64.rpm                                                                                                                                     | 428 MB  00:06:02     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                             1.3 MB/s | 482 MB  00:06:08file:///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-3.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 程序修改。
  正在安装    : mysql-community-client-plugins-8.0.24-1.el7.x86_64                                                                                                                                           1/9 
  正在安装    : mysql-community-common-8.0.24-1.el7.x86_64                                                                                                                                                   2/9 
  正在安装    : mysql-community-libs-8.0.24-1.el7.x86_64                                                                                                                                                     3/9 
  正在安装    : mysql-community-libs-compat-8.0.24-1.el7.x86_64                                                                                                                                              4/9 
  正在安装    : mysql-community-client-8.0.24-1.el7.x86_64                                                                                                                                                   5/9 
  正在安装    : mysql-community-server-8.0.24-1.el7.x86_64                                                                                                                                                   6/9 
  正在更新    : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                                                7/9 
  清理        : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                                                8/9 
  正在删除    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                           9/9 
  验证中      : mysql-community-server-8.0.24-1.el7.x86_64                                                                                                                                                   1/9 
  验证中      : mysql-community-libs-8.0.24-1.el7.x86_64                                                                                                                                                     2/9 
  验证中      : mysql-community-common-8.0.24-1.el7.x86_64                                                                                                                                                   3/9 
  验证中      : 2:postfix-2.10.1-9.el7.x86_64                                                                                                                                                                4/9 
  验证中      : mysql-community-libs-compat-8.0.24-1.el7.x86_64                                                                                                                                              5/9 
  验证中      : mysql-community-client-plugins-8.0.24-1.el7.x86_64                                                                                                                                           6/9 
  验证中      : mysql-community-client-8.0.24-1.el7.x86_64                                                                                                                                                   7/9 
  验证中      : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                           8/9 
  验证中      : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                                                9/9 

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

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

作为依赖被升级:
  postfix.x86_64 2:2.10.1-9.el7                                                                                                                                                                                  

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

完毕!
[root@bigdata-senior02 mysql]# 

3.启动mysql

[root@bigdata-senior02 mysql]# systemctl start mysqld
[root@bigdata-senior02 mysql]# 

4.初始化数据库

mysqld --initialize

5.查看数据库密码

[root@bigdata-senior02 mysql]# grep passwd /var/log/mysqld.log 
[root@bigdata-senior02 mysql]# grep password /var/log/mysqld.log 
2021-04-24T09:40:08.666303Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: z9Fkgh/,ZDx+
[root@bigdata-senior02 mysql]# 

6.登陆、重置root密码

[root@bigdata-senior02 mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.24

Copyright (c) 2000, 2021, 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 databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@localhost identified by MysqlRootPs;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> alter user root@localhost identified by My_RootPs2;
Query OK, 0 rows affected (0.01 sec)

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

mysql>

7.创建普通用户,创建数据库

mysql> create database hivemetastore character set =utf8mb4;
Query OK, 1 row affected (0.01 sec)

mysql> create user hive@% identified by Hive_Ps2;
Query OK, 0 rows affected (0.02 sec)

mysql> grant all on hivemetastore to hive@%;
ERROR 1046 (3D000): No database selected
mysql> grant all on hivemetastore.* to hive@%;
Query OK, 0 rows affected (0.01 sec)

mysql> 

 

centos7国内镜像安装最新版mysql

原文:https://www.cnblogs.com/Alex-Zeng/p/14697608.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!