1.官网下载yum包

 [root@test01 test]# wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm  ./

2.安装mysql依赖包

[root@test01 test]# ls
mysql57-community-release-el7-10.noarch.rpm
[root@test01 test]# yum install -y mysql57-community-release-el7-10.noarch.rpm

3.安装mysql

[root@test01 test]# yum install -y mysql-community-server.x86_64

4.启动mysql服务

[root@test01 test]# systemctl start mysqld.service 

mysql服务器初次启动时,会有一个初始化过程,给服务器一个空的数据目录(data)

  1.服务器被初始化

  2.在数据目录中生成SSL证书和密钥文件

  3.安装validate_password插件并启动

  4.创建超级用户“root”@“localhost”,密码被设置并且存储在错误日志文件中

5.在错误日志中找出密码并进入服务器修改密码

[root@test01 test]# grep 'temporary password' /var/log/mysqld.log

找出密码后直接登入服务器,修改密码

[root@test01 test]# mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'redhat';

密码若太过简单会报错

也可以运行mysql_secure_installation程序来修改密码,不过官网上建议5.7及以上版本不建议运行这个程序,因为这个程序的功能已经被yum存储仓库安装完成

mysql_secure_installation — Improve MySQL Installation Security for details.
Do not run mysql_secure_installation after an installation of MySQL 5.7 or higher, as the function of the program has already been performed by the Yum repository installation.

还有一种方法是编辑mysql的配置文件 my.cnf 在 [mysqld]下添加一行skip-grant-tables,重启服务

[root@test01 test]# vim /etc/my.cnf
[root@test01 test]# systemctl restart mysqld.service
[root@test01 test]# mysql -uroot
mysql> use mysql    ==>使用mysql数据库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> update user set password=PASSWORD('redhat') where user='root'; ==>修改user表的数据,修改用户root的密码
Query OK, 0 rows affected, 1 warning (0.11 sec)
Rows matched: 4 Changed: 0 Warnings: 1 mysql> flush privileges;    ==>刷新权限表
Query OK, 0 rows affected (0.07 sec)

退出数据库,在编辑配置文件my.cnf,删除新增的那一行

mysql> exit
Bye
[root@test01 test]# vim /etc/my.cnf
[root@test01 test]# systemctl restart mysqld.service
[root@test01 test]# mysql -uroot -predhat
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 2
Server version: 5.7.24 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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>

可以正常登入了

6.设置开机自启

[root@test01 test]# systemctl enable mysqld.service

mysql5.7版本yum安装---redhat7.0的更多相关文章

  1. 编译安装 varnish-4.1.2和yum 安装 varnish-4.0.3

    vanish可以让用户自己选择缓存数据是存于内存还是硬盘,存于内存一般基于二八法则即常访问的数据是磁盘存储的总数据五分之一,因此内存也应该是硬盘文件大概五分之一.如果有多台vanish则,总内存满足即 ...

  2. Mysql5.7版本编译安装及配置

    配置yum安装方式 1.配置本地yum源 vim /etc/yum.repos.d/rhel-source.repo [rhel-source] name=Red Hat Enterprise Lin ...

  3. mysql80版本—yum安装—图文全过程

    这是官网的Quick Giude:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ 以下为自己安装的步骤: 第一步:下载.rpm安装包 ...

  4. CentOS通过yum安装php7.0

    一.删除旧版本 如果已经安装过php就先删除之前的版本.检查方法如下: yum list installed | grep php 然后将安装的包进行删除 比如 yum remove php.x86_ ...

  5. CentOS7使用yum安装MySQL8.0

    1.yum仓库下载MySQL:sudo yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch. ...

  6. Centos下Yum安装PHP7.0

    默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案: 1.检查当前安装的PHP包 yum list installed | grep php 如果有安装的PHP包,先删除他们 ...

  7. mysql5.7版本tar包手动安装---redhat7.0

    1.官网下载安装包,删除系统自带的mariadb,查到几个包,卸载几个包,总之得删除干净 [root@localhost Desktop]# yum list | grep mariadb maria ...

  8. mysql5.7版本免安装配置教程

    自己花了两天时间才搞清楚,希望对新手有一定帮助,有问题可以联系哦! mysql分为安装版本msi,免安装要压缩版本ZIP,下载网址:http://dev.mysql.com/downloads 免安装 ...

  9. Red Hat Enterprise Linux / CentOS 7 yum安装zabbix4.0

    添加Zabbix存储库安装存储库配置包. 该软件包包含yum(软件包管理器)配置文件. rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_6 ...

随机推荐

  1. C# 读取xml——XmlReader和XElement

    1.有些xml文件头部有DTD,程序解析的时候会报错 如:其他信息: 打开外部 DTD“file:///E:/PM数据/MeContext=CDF2775/MeasDataCollection.dtd ...

  2. python __str__() 和 __repr__()是干啥的

    1. 没定义__str__() print的时候得不到自己想要的东西 类默认转化的字符串基本没有我们想要的一些东西,仅仅包含了类的名称以及实例的 ID (理解为 Python 对象的内存地址即可).虽 ...

  3. 信步漫谈之Quartz—分布式调度(整合spring早期版本【低于spring3.1】)

    一.环境 使用的jar包:spring2.5.6.quartz1.8.6 二.注意点 因为spring内置的quartz版本变化,所以存在spring和quartz版本接口兼容情况,如下: 1)spr ...

  4. (Review cs231n) Object Detection

    目标:我们有几个类别,然后我们要在这张图中找到这些类的所有实例 解决思路:是否可以按照回归的思路进行求解呢? 但是受限制于确定的种类输出问题. 方法:分类和回归是解决问题的两个套路,我们现在对于目标的 ...

  5. springmvc 配置之 mvc:default-servlet-handler

    配置dispatchServlet的方法一般是: <servlet> <servlet-name>mvc-servlet</servlet-name> <se ...

  6. golang学习笔记20 一道考察对并发多协程操作一个共享变量的面试题

    golang学习笔记20 一道考察对并发多协程操作一个共享变量的面试题 下面这个程序运行的能num结果是什么? package main import ( "fmt" " ...

  7. 怎么把Thu Nov 22 2018 10:49:36 GMT+0800转换成正常日期

    this.data //Thu Nov 22 2018 10:49:36 GMT+0800 this.date_of_birth = date.getFullYear() + '-' + (date. ...

  8. JAVA获取计算机IP地址

    import java.net.InetAddress;import java.net.UnknownHostException;public class HuoQu {    public stat ...

  9. P3440 [POI2006]SZK-Schools(费用流)

    P3440 [POI2006]SZK-Schools 每所学校$i$开一个点,$link(S,i,1,0)$ 每个编号$j$开一个点,$link(i,T,1,0)$ 蓝后学校向编号连边,$link(i ...

  10. P4630 [APIO2018] Duathlon 铁人两项

    思路 圆方树,一个点双中的所有点都可以被经过,所以给圆点赋值-1,方点赋值为圆点个数,统计圆点两两之间的路径权值和即可 代码 #include <cstdio> #include < ...