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. 【kafka学习之六】kakfa消息生产、消费示例

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk1.8 kafka_2.11-0.11.0.0 zookeepe ...

  2. 【转载】常用精品API接口汇总

    原文链接戳这里~~ 下面列举了100多个国内常用API接口,并按照 笔记.出行.词典.电商.地图.电影.即时通讯.开发者网站.快递查询.旅游.社交.视频.天气.团队协作.图片与图像处理.外卖.消息推送 ...

  3. 结合API Gateway和Lambda实现登录时的重定向和表单提交请求(Python3实现)

    1. 创建Lambda函数,代码如下: from urllib import parse def lambda_handler(event, context): body = event['body' ...

  4. 初学javascript《一》break和continue的标签问题

    <script>var iNum = 0;outermost:for (var i=0; i<3; i++) {   for (var j=0; j<3; j++) {     ...

  5. CCF CSP 201312-1 出现次数最多的数

    题目链接:http://118.190.20.162/view.page?gpid=T5 问题描述 试题编号: 201312-1 试题名称: 出现次数最多的数 时间限制: 1.0s 内存限制: 256 ...

  6. LInux命令英文全称

    Linux命令英文全称   su = Swith user 切换用户,切换到root用户cat = Concatenate 串联uname = Unix name 系统名称df = Disk free ...

  7. 随手记一 2018/04/23 Ajax基础了解

    1.什么是ajax? 主要目的是用来实现客户端和服务器之间的异步通信,实现页面的局部刷新 2.同步和异步! 同步:当多个线程同时向一个数据发送请求时,必须是A先执行完毕才可以给B,会出现阻塞的情况,但 ...

  8. phpstrom 快速定位到当前编辑文件

    方法1(手动定位): 打开所要查找的文件,然后点击上图中红框中的按钮即可快速定位. 方法二(自动定位): Project面板右上角有个准星类的图标,点击后勾选上Autoscorll from Sour ...

  9. Apache Maven 3.6.1配置安装

    Apache Maven 3.6.1配置安装 一.下载 maven下载地址:http://maven.apache.org/download.cgi 二.安装 1,解压即可用 2,环境变量配置 MAV ...

  10. mysql批量查询

    一般批量查询的时候都是in关键字,但是在数据量大的时候,效率低下. 这个时候我们就可以考虑使用union . xml 核心代码 <select id="selectList" ...