zoukankan      html  css  js  c++  java
  • centos7 下载指定版本mysql

    1:查看 mysql  yum源 (没有则编辑添加进去)

    cat /etc/yum.repos.d/mysql-community.repo
    [root@localhost mysql5.7.30]# cat /etc/yum.repos.d/mysql-community.repo 
    [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
    
    [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
    
    # Enable to use MySQL 5.5
    [mysql55-community]
    name=MySQL 5.5 Community Server
    baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
    enabled=0
    gpgcheck=1
    gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    # Enable to use MySQL 5.6
    [mysql56-community]
    name=MySQL 5.6 Community Server
    baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
    enabled=0
    gpgcheck=1
    gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
    # Note: MySQL 5.7 is currently in development. For use at your own risk.
    # Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
    [mysql57-community-dmr]
    name=MySQL 5.7 Community Server Development Milestone Release
    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

    2:下载mysql5.7.30

    yum install --downloadonly --downloaddir=/song  mysql-community-client-5.7.30 mysql-community-common-5.7.30 mysql-community-libs-5.7.30 mysql-community-server-5.7.30

    下载详情如下

    [root@localhost song]# yum install --downloadonly --downloaddir=/song  mysql-community-client-5.7.30 mysql-community-common-5.7.30 mysql-community-libs-5.7.30 mysql-community-server-5.7.30
    已加载插件:fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: mirrors.tuna.tsinghua.edu.cn
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 mysql-community-client.x86_64.0.5.7.30-1.el7 将被 安装
    ---> 软件包 mysql-community-common.x86_64.0.5.7.30-1.el7 将被 安装
    ---> 软件包 mysql-community-libs.x86_64.0.5.7.30-1.el7 将被 安装
    ---> 软件包 mysql-community-server.x86_64.0.5.7.30-1.el7 将被 安装
    --> 解决依赖关系完成
    
    依赖关系解决
    
    =============================================================================================================================================================================================
     Package                                             架构                                版本                                       源                                                  大小
    =============================================================================================================================================================================================
    正在安装:
     mysql-community-client                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                               25 M
     mysql-community-common                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              311 k
     mysql-community-libs                                x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              2.3 M
     mysql-community-server                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              173 M
    
    事务概要
    =============================================================================================================================================================================================
    安装  4 软件包
    
    总下载量:201 M
    安装大小:875 M
    Background downloading packages, then exiting:
    No Presto metadata available for mysql57-community-dmr
    警告:/song/mysql-community-libs-5.7.30-1.el7.x86_64.rpm.14686.tmp: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY                                       ] 224 kB/s | 2.3 MB  00:15:08 ETA 
    mysql-community-libs-5.7.30-1.el7.x86_64.rpm.14686.tmp 的公钥尚未安装
    (1/3): mysql-community-libs-5.7.30-1.el7.x86_64.rpm                                                                                                                   | 2.3 MB  00:00:11     
    mysql-community-server-5.7.30- FAILED                                            7% [====-                                                                 ]  269 B/s |  14 MB 201:41:07 ETA 
    http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
    正在尝试其它镜像。
    mysql-community-client-5.7.30- FAILED                                          
    http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
    正在尝试其它镜像。
    (2/3): mysql-community-server-5.7.30-1.el7.x86_64.rpm                                                                                                                 | 173 MB  00:06:14     
    (3/3): mysql-community-client-5.7.30-1.el7.x86_64.rpm                                                                                                                 |  25 MB  00:00:57     
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    总计                                                                                                                                                         421 kB/s | 201 MB  00:08:08     
    exiting because "Download Only" specified

    3:查看

     4:安装mysql5.7.30的rpm文件

    rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
    rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
    rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
    rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm 

    安装详情如下

    [root@localhost mysql5.7.30]# rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm 
    警告:mysql-community-common-5.7.30-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:mysql-community-common-5.7.30-1.e################################# [100%]
    [root@localhost mysql5.7.30]# rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm 
    警告:mysql-community-libs-5.7.30-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:mysql-community-libs-5.7.30-1.el7################################# [100%]
    [root@localhost mysql5.7.30]# rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm 
    警告:mysql-community-client-5.7.30-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:mysql-community-client-5.7.30-1.e################################# [100%]
    [root@localhost mysql5.7.30]# rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm 
    警告:mysql-community-server-5.7.30-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:mysql-community-server-5.7.30-1.e################################# [100%]

    安装完进行 验证 验证前先查看mysql是否启动 没启动的话先启动mysql

     systemctl status mysqld.service
     systemctl start mysqld.service

    查看初始的临时密码

    [root@localhost mysql5.7.30]# cat /var/log/mysqld.log  | grep password
    2020-08-12T13:35:12.703762Z 1 [Note] A temporary password is generated for root@localhost: m-n)tiX!9Tj)

    临时密码登录,并修改密码

    [root@localhost mysql5.7.30]# mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.7.30
    
    Copyright (c) 2000, 2020, 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> 
    mysql> 
    mysql> set global validate_password_policy=0;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> set global validate_password_length=1;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> alter user 'root'@'localhost' identified by '1234';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'zt_dev'@'%' IDENTIFIED BY '1234' WITH GRANT OPTION;
    Query OK, 0 rows affected, 1 warning (0.00 sec)

    mysql
    > flush privileges -> ; Query OK, 0 rows affected (0.00 sec) mysql> exit
  • 相关阅读:
    13年7月memory point
    getDefinitionByName getDefinition 区别
    cocos2d-html5版日历组件
    一个js对象的代码结构
    计算机操作系统复习
    计算机组成原理复习
    最新的hustoj搭建姿势
    推荐算法学习笔记
    BUPT 2012复试机考 4T
    BUPT 2012复试机考 3T
  • 原文地址:https://www.cnblogs.com/s6-b/p/13490154.html
Copyright © 2011-2022 走看看