虚拟机环境是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. Get Random number

    , int pMaxVal = int.MaxValue) { int m = pMaxVal - pMinVal; int rnd = int.MinValue; decimal _base = ( ...

  2. Ztree节点增加删除修改和Icheck的用法

    简介 官方文档:http://www.treejs.cn/v3/api.php zTree 是一个依靠 jQuery 实现的多功能 “树插件”, 而且拥有较好的浏览器兼容性,有着丰富的功能以及可以自定 ...

  3. vi光标移动

    1.上下左右移动 k  :上移一行 j  :下移一行 h :左移一行 l :右移一行 2.移到当前屏幕的首.中.尾部 H :移到当前屏幕的首部 M    :移到当前屏幕的中部 L :移到当前屏幕的尾部 ...

  4. 【菜鸟学Python】案例一:汇率换算

    汇率换算V1.0 案例描述: 设计一个汇率换算器程序,其功能是将外币换算成人民币,或者相反 案例分析: 分析问题:分析问题的计算部分: 确定问题:将问题划分为输入.处理及输出部分: 设计算法:计算部分 ...

  5. andorid开发build.gradle 增加几种产品的方法

    因为需要有些ndk的开发,cmakelists里需要定义不同的变量,这个在网上搜索解决方案,不是很容易就直接找到答案. 尝试了不少,最后找到解决方案.升级Gradle3.0,这个文章价值高. 在ras ...

  6. db2一、查询

    1.查询单条数据( fetch 放在最后) select * from x where 1=1 order by id fetch first 1 rows only

  7. php----------linux下安装php的swoole扩展

    1.首先你已经安装好了php环境,这里就不介绍php环境的安装了.如果你是编译安装记得将php加入环境变量,以便于方便查看扩展是否安装成功. 2.我安装的php环境缺少了要给东西,详细看下图 如果你没 ...

  8. 排序之选择排序(SelectSort)

    package com.sort; /* * 选择排序 * 把第一位与其他数进行比较,这样每轮比较都会出现一个最大值或最小值 * 根据需要让升序或降序排列 */ public class Select ...

  9. jquery autocomplete 设置滚动条

    加入样式 .ui-autocomplete{height:250px; overflow-y: scroll; overflow-x: hidden;}

  10. zw字王《中华大字库》2018版升级项目正式启动

    zw字王<中华大字库>2018版升级项目正式启动 https://www.cnblogs.com/ziwang/p/9500537.html 这次升级是和字库协会一起合作,首批推出的字体, ...