虚拟机环境是Linux  Red Hat Enterprlse Linux (64位),本次安装的是Mysql 8.0版本。

由于有经验了,所以又弄了台虚拟机练手,承接上一篇博客(https://www.cnblogs.com/lelelong/p/10767049.html

补充默认密码的截图

可以在文件 【/var/log/mysqld.log】 中获取,如图:

[root@localhost116 mysql]# tail -100f /var/log/mysqld.log
--25T04::.315933Z [System] [MY-] [Server] /usr/sbin/mysqld (mysqld 8.0.) initializing of server in progress as process
--25T04::.323029Z [Note] [MY-] [Server] A temporary password is generated for root@localhost: fu#0YkCp)uv8
--25T04::.526215Z [System] [MY-] [Server] /usr/sbin/mysqld (mysqld 8.0.) initializing of server has completed
--25T04::.986257Z [System] [MY-] [Server] /usr/sbin/mysqld (mysqld 8.0.) starting as process
--25T04::.635553Z [Warning] [MY-] [Server] CA certificate ca.pem is self signed.
--25T04::.667243Z [System] [MY-] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.15' socket: '/var/lib/mysql/mysql.sock' port: MySQL Community Server - GPL.
--25T04::.765178Z [System] [MY-] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port:

这里默认密码就是   fu#0YkCp)uv8

访问:

[root@localhost107 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 8.0. Copyright (c) , , 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>

在【/etc/my.cnf】中修改配置,将default-authentication-plugin=mysql_native_password  去掉前面的#,如下图:

重启mysql服务

[root@localhost107 mysql]# service mysqld restart
停止 mysqld: [确定]
正在启动 mysqld: [确定]
[root@localhost107 mysql]#

其他命令:

show variables like '%auth%';    #查看 default_authentication_plugin 的值
show variables like 'default_password_lifetime'; #查看 default_password_lifetime 的值
show variables like '%pass%'; #查看模糊查询pass 属性的值
select user,host,plugin from mysql.user; #查看user表相关字段
set global validate_password_policy=0; #设置 validate_password_policy 全局值为0,可不遵循密码规则
set global validate_password_length=4; #设置 validate_password_length 密码长度最少位数
flush privileges; #修改生效
create user 用户名 identified by '密码'; #新增用户及密码
grant all on *.* to 用户名; #给用户授权所有权限

特别注意:8.0版本中 validate_password.policy /  validate_password.length  最后一个链接符不是下划线_而是点.不然会报错,如下:

mysql> set global validate_password_policy=;
ERROR (HY000): Unknown system variable 'validate_password_policy'

参考博客:https://www.cnblogs.com/leohahah/p/9044904.html

Linux环境——MySQL安装及配置(8.0版本)的更多相关文章

  1. Linux环境——MySQL安装及配置(5.7版本)

    数据库安装包下载地址:https://dev.mysql.com/downloads/mysql/ 我的环境是Linux  Red Hat Enterprlse Linux (64位),本次安装的是M ...

  2. Linux下MySQL安装及配置

    Linux下MySQL安装及配置 安装MySQL Ubuntu系统中,直接使用apt install的方式去安装MySQL的服务端和客户端,MySQL的客户端必须安装,否则无法通过命令连接并操作MyS ...

  3. Linux下MySQL安装和配置

    --Linux下MySQL安装和配置 ---------------------------2014/05/18 Linux下MySQL的配置和安装 本文的安装采用 rpm 包安装 1.首先在官网下载 ...

  4. linux环境jdk安装及配置

    linux环境jdk安装及配置 linux环境jdk安装及配置 1.下载jkd( http://www.oracle.com/technetwork/java/javase/downloads/ind ...

  5. (3)ElasticSearch在linux环境中安装与配置head插件

    1.简介 ElasticSearch-Head跟Kibana一样也是一个针对ElasticSearch集群操作的API的可视化管理工具,它提供了集群管理.数据可视化.增删改查.查询语句等功能,最重要还 ...

  6. Windows环境——MySQL安装及配置

    Mysql安装 下载地址:https://dev.mysql.com/downloads/mysql/ 根据个人需求,选择对应的操作系统,进行安装,本次安装的版本为5.7.24版本. 1.  安装完成 ...

  7. Linux环境GitLab安装与配置

    1.背景 近期公司源代码管理工具从svn转向git,因此要在服务器上部署gitlab,总共部署了两台服务器,一台是Ubuntu server 17.04,一台是Centos7.在部署的过程中遇到不少问 ...

  8. linux 下 mysql安装和配置

    最近在学习R语言,看到R与数据库交互这一部分,就自己动手实践了一下,数据库选择的是mysql,主要记录下linux下怎么安装mysql. 网上的很多资料都有相关的文章,这里只是记录下自己安装过程中遇到 ...

  9. Linux\CentOS MySql 安装与配置

    一.MySQL 简介 MySQL 是一个关系型数据库管理系统,是MySQL AB公司开发,现在属于 Oracle 旗下产品. MySQL 采用标准化语言.体积小.速度快.成本低.开源等特点使得一些中小 ...

随机推荐

  1. Redis的持久化之RDB方式

    RDB方式 Redis是默认支持的 优势:只有一个文件,时间间隔的数据,可以归档为一个文件,方便压缩转移(就一个文件) 劣势:如果宕机,数据损失比较大,因为它是没一个时间段进行持久化操作的.也就是积攒 ...

  2. vscode编译发布exe

    命令1: dotnet build -r win-x64 命令2: dotnet publish -c Release -r win-x64 -r|--runtime:(window rid或者lin ...

  3. 002-zookeeper 基本配置、安装启动 windows环境

    一. 概述 ZooKeeper是Hadoop的正式子项目,它是一个针对大型分布式系统的可靠协调系统,提供的功能包括:配置维护.名字服务.分布式同步.组服务等.ZooKeeper的目标就是封装好复杂易出 ...

  4. 【tomcat启动失败问题】Unable to start embedded Tomcat

    启动spring boot 项目后抛出如下异常: org.springframework.context.ApplicationContextException: Unable to start em ...

  5. monent API详解

    参考链接:https://www.jianshu.com/p/9c10543420de

  6. emqx源码编译

    1  下载  github上下载 2  找台虚拟机,安装编译所需的环境,erlang   make等 3  执行make命令 重点说一下第3步: 主要是make命令报错 解释:执行make命令后,依赖 ...

  7. 10个Python基础练习项目,你可能不会想到练手教程还这么有趣

    美国20世纪最重要的实用主义哲学家约翰·杜威提出一个学习方法,叫做:Learning By Doing,在实践中精进.胡适.陶行知.张伯苓.蒋梦麟等都曾是他的学生,杜威的哲学也影响了蔡元培.晏阳初等人 ...

  8. des加密算法java&c#

    项目中用到的数据加密方式是ECB模式的DES加密得到的十六进制字符串.技术支持让写一个.net版的加密算法.这里做一下记录. java版: 16进制使用的是bouncycastle. import c ...

  9. 201808_summary

    @Consumes @Produces分别表示入参和出参数吗 可以这样讲.但是不是很到位.是限定作用,类似于filterconsumes: 指定处理请求的提交内容类型(Content-Type),例如 ...

  10. python小程序--one

    #!/usr/bin/env python # _*_ coding:utf8 _*_ import sys user_lock_file="user_lock.txt" # 用户 ...