Centos 6 / 7 官方源安装Mysql 5.7

1 检查当前系统是否有旧版本

# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64

#  rpm -qa | grep MySQL

1.1 如有旧版本可以删除

# rpm -e  mysql-libs-5.1.71-1.el6.x86_64  --nodeps

2 下载MySQL官方 Yum Repository

根据系统下载6或7

(6) wget -i http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
(7) wget -i  http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

如果发现证书错误需要添加参数:

wget --no-check-certificate  http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

3 安装和确认仓库内容

3.1 安装

# rpm -ivh mysql57-community-release-el6-7.noarch.rpm

3.2 检查有效仓库

# yum repolist enabled
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                           repo name                                          status
base                                              CentOS-6 - Base                                    6,713
extras                                            CentOS-6 - Extras                                        47
mysql-connectors-community         MySQL Connectors Community                 129
mysql-tools-community                  MySQL Tools Community                              90
mysql57-community                       MySQL 5.7 Community Server                    396
updates                                         CentOS-6 - Updates                                 1,046
repolist: 8,421

3.3 查询安装版本

# yum list mysql-community*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Available Packages
mysql-community-client.i686                          5.7.30-1.el6                mysql57-community         
mysql-community-client.x86_64                        5.7.30-1.el6                mysql57-community         
mysql-community-common.i686                          5.7.30-1.el6                mysql57-community         
mysql-community-common.x86_64                        5.7.30-1.el6                mysql57-community         
mysql-community-devel.i686                           5.7.30-1.el6                mysql57-community         
mysql-community-devel.x86_64                         5.7.30-1.el6                mysql57-community         
mysql-community-embedded.i686                        5.7.30-1.el6                mysql57-community         
mysql-community-embedded.x86_64                      5.7.30-1.el6                mysql57-community         
mysql-community-embedded-devel.i686                  5.7.30-1.el6                mysql57-community         
mysql-community-embedded-devel.x86_64                5.7.30-1.el6                mysql57-community         
mysql-community-libs.i686                            5.7.30-1.el6                mysql57-community         
mysql-community-libs.x86_64                          5.7.30-1.el6                mysql57-community         
mysql-community-libs-compat.i686                     5.7.30-1.el6                mysql57-community         
mysql-community-libs-compat.x86_64                   5.7.30-1.el6                mysql57-community         
mysql-community-release.noarch                       el6-5                       mysql-connectors-community
mysql-community-server.x86_64                        5.7.30-1.el6                mysql57-community         
mysql-community-test.x86_64                          5.7.30-1.el6                mysql57-community

4 安装

# yum install mysql-server
Dependencies Resolved
===========================================================================================================
 Package                         Arch            Version                  Repository                  Size
===========================================================================================================
Installing:
 mysql-community-server          x86_64          5.7.30-1.el6             mysql57-community          162 M
Installing for dependencies:
 mysql-community-client            x86_64          5.7.30-1.el6             mysql57-community           25 M
 mysql-community-common          x86_64          5.7.30-1.el6             mysql57-community          370 k
 mysql-community-libs             x86_64          5.7.30-1.el6             mysql57-community          2.4 M
 numactl                             x86_64           2.0.9-2.el6               base                             74 k

Transaction Summary
===========================================================================================================
Install       5 Package(s)

Total download size: 189 M
Installed size: 905 M
Is this ok [y/N]:

5 数据库初始化

5.1 启动mysql 服务

# service mysqld start
Initializing MySQL database:       [  OK  ]
Starting mysqld:                          [  OK  ]

5.2 查看初始密码

# grep password /var/log/mysqld.log
 [Note] A temporary password is generated for root@localhost: l#.&dX3Hgade
 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)

5.3 登录

# mysql -u root -pl#.&dX3Hgade

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>

5.4 更改初始密码(必须更改初始密码,默认策略大小写数字加特殊字符)

mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statemen

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password-8888';

5.5 确认和修改密码策略

mysql> show variables like '%password%';

# vi /etc/my.cnf
添加 validate_password_policy配置
选择 0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件

# 添加validate_password_policy配置
validate_password_policy=0
# 关闭密码策略
validate_password = off

修改后重启服务

 5.6 添加远程管理权限

mysql > grant all privileges on *.* to 'root'@'192.168.1.1' identified by 'password' with grant option;

mysql > flush privileges;

Centos Yum 安装 Mysql 5.7的更多相关文章

  1. centos yum 安装 mysql

      centos7下使用yum安装mysql 时间:2015-03-07 21:26:20      阅读:87445      评论:0      收藏:1      [点我收藏+] 标签: Cen ...

  2. centos yum安装mysql

    查看有没有安装包 # yum list mysql 安装mysql客户端 # yum install mysql # yum list mysql-server 安装mysql 服务器端 # yum ...

  3. Centos yum 安装mysql报错 No package mysql-server available.

    这是因为大多数mysql-*的资源名称被mariadb-*重命名了 所以换成 yum install mariadb-server 就可以了 PS[摘自网络] MariaDB不仅仅是Mysql的一个替 ...

  4. 阿里云服务器Linux CentOS安装配置(三)yum安装mysql

    阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...

  5. CentOS 7.0下使用yum安装MySQL

    CentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql,但是CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1 ...

  6. centos yum 安装php mysql

    1 安装php7 查看 centos 版本 # cat /etc/centos-release 删除之前的 php 版本 # yum remove php* php-common rpm 安装 Php ...

  7. 使用yum方式在centOS上安装mysql

    1.操作系统及MySQL版本 1.1 操作系统版本 CentOS release 6.5 (Final) 1.2 MySQL版本 mysql-5.1.73-3.el6_5.x86_64mysql-li ...

  8. centOS Linux下用yum安装mysql

    centOS Linux下用yum安装mysql      第一篇:安装和配置MySQL   第一步:安装MySQL   [root@192 local]# yum -y install mysql- ...

  9. 在 CentOS 7.5 64位上使用 yum 安装 MySQL 8.0

    前段时间在 CentOS 7.5 64位上安装 MySQL 8.0.查了些资料,在这里记录一下详细的安装和设置步骤. 一.安装 使用yum安装MySQL之前需要先下载对应的.rpm文件,下载方法: 去 ...

随机推荐

  1. Jmeter和Postman做接口测试的区别,孰优孰劣?

    区别1:用例组织方式 不同的目录结构与组织方式代表不同工具的测试思想,学习一个测试工具应该首先了解其组织方式. Jmeter的组织方式相对比较扁平,它首先没有WorkSpace(工作空间)的概念,直接 ...

  2. NumPy之:理解广播

    目录 简介 基础广播 广播规则 简介 广播描述的是NumPy如何计算不同形状的数组之间的运算.如果是较大的矩阵和较小的矩阵进行运算的话,较小的矩阵就会被广播,从而保证运算的正确进行. 本文将会以具体的 ...

  3. 从几道题目带你深入理解Event Loop_宏队列_微队列

    目录 深入探究JavaScript的Event Loop Event Loop的结构 回调队列(callbacks queue)的分类 Event Loop的执行顺序 通过题目来深入 深入探究Java ...

  4. Educational Codeforces Round 92 (Rated for Div. 2)

    A.LCM Problem 题意:最小公倍数LCM(x,y),处于[l,r]之间,并且x,y也处于[l,r]之间,给出l,r找出x,y; 思路:里面最小的最小公倍数就是基于l左端点的,而那个最小公倍数 ...

  5. 狄克斯特拉(Dijkstra)算法

    引入 从A点到B点的最短路径是什么?求最短路径的两种算法:Dijkstra算法和Floyd算法. 网图:带权图. 非网图最短路径:两顶点间经过的边数最少的路径.(非网图也可被理解为各边权值为1的网图. ...

  6. Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

    selenium + java + mac + idea 报错分析: 网上搜的教程,配置selenium 自动化测试环境,都是只让导入 client-combined-3.141.59-sources ...

  7. 保姆级别的RabbitMQ教程!一看就懂!(有安装教程,送安装需要的依赖包,送Java、Golang两种客户端教学Case)

    保姆级别的RabbitMQ教程!一看就懂!(有安装教程,送安装需要的依赖包,送Java.Golang两种客户端教学Case)   目录 什么是AMQP 和 JMS? 常见的MQ产品 安装RabbitM ...

  8. fedora21 桌面用户自动登录lightdm.conf -20190520 方法

    修改 /etc/lightdm/lightdm.conf 步骤:1解除注释#autologin-user=root 2等号 =后面是root或者普通用户的用户名 例如:root用户自动登录 autol ...

  9. "sar"工具 利用率

    LTP--linux稳定性测试 linux性能测试 ltp压力测试   余二五 2017-11-14 16:20:00 浏览1172 linux 日志 配置 内存管理 测试 脚本 性能测试 压力测试 ...

  10. MySQL 查询操作

    目录 基本语法 查询常量 查看表达式 查询函数 查询指定字段 查询所有列 列别名 表别名 条件查询 条件查询运算符 逻辑查询运算符 排序与分页 排序查询(order by) 排序方式 limit 分组 ...