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. spring源码解析2--容器的基本实现

    spring的主要特性是IOC,实现IOC的关键是bean,而更关键的是如何bean的管理容器,也就是BeanFactory,本文的目标是弄清楚BeanFactory具体是怎么样的存在. 先看下最简单 ...

  2. Instrumentation接口详解

    Instrumentation接口位于jdk1.6包java.lang.instrument包下,Instrumentation指的是可以独立于应用程序之外的代理程序,可以用来监控和扩展JVM上运行的 ...

  3. [最新]ABP ASP.NET Zero v5.5.2 破解

    参考https://www.cnblogs.com/xajh/p/8428818.html后, 搞定了Abp.AspNetZeroCore.dll.Abp.AspNetZeroCore.Web.dll ...

  4. tomcat启动命令行中文乱码

    1.找到${CATALINA_HOME}/conf/logging.properties 2.添加语句:java.util.logging.ConsoleHandler.encoding = GBK ...

  5. redhat7 配置使用centos的yum源

    新安装了redhat7.安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Man ...

  6. qt界面操作

    //控制死窗体 int width = this->geometry().width(); int height = this->geometry().height(); this-> ...

  7. 如何改变vim中的光标形状 : 在插入状态下显示为 beam?而在 其他 状态下 为 block?

    分成两种情况来说明: 如果是在 shell 即: gnome-termial终端中, 来启动或 使用 vim的话, 你是 无法 实现这种需求的: 改变vim中的光标形状 : 在插入状态下显示为 bea ...

  8. 使用telnet进行Dubbo接口测试

    telnet进入dubbo 查看pid $ jps -l 26048 org.apache.catalina.startup.Bootstrap 12388 org.jetbrains.jps.cmd ...

  9. sublime Text3下载与安装以及解决安装Install Package时遇见的问题

    最近下载安装sublime Text3后,在安装Install Package时遇到了几个问题,网上搜了一大圈终于解决了,特此记录为以后之便. 一.下载安装sublime Text3 1.sublim ...

  10. Elasticsearch Windows下安装及配置集群

    首先打开网址:https://www.elastic.co/cn/ 进入如下页面: 下载: 解压: 进入bin文件夹下,运行bat文件: 成功后打开浏览器输入地址: 安装head插件: 首先安装nod ...