今天看啥  ›  专栏  ›  itczt

sql自学笔记(十一)——MySQL8.0版本的新特性(一)

itczt  · 简书  ·  · 2019-04-29 08:44

MySQL8.0版本的新特性

新特性

账户安全

  • 用户创建和授权
  • 认证插件更新
  • 密码管理
  • 角色管理

用户创建和授权

MySQL8.0创建用户和用户授权的命令需要分开执行:

create user 'tony'@'%' identified by 'Tony@2019';//用户的创建
grant all prinegs on *.* to ‘tony’@‘%’;//用户的授权

操作步骤
5.7版本

查询默认用户
select user ,host from mysql.user;
创建一个用户(用户的创建与授权,创建一个新用户)
grant all privlleges on *.* to 'tong'@'%' identified by 'Tong@2019'
再查询默认用户
select user ,host from mysql.user;

8.7版本

查询默认的用户
select host,user from 'mysql.user';
创建新用户
create user 'tony'@'%' identified by 'Tony@2019';
再查阅
select host,user from 'mysql.user';
进行授权
grat all privileges on *.* to 'tony'@'%';

认证插件更新

MySQL8.0中默认的身份认证插件是:

caching _ cha2 _ password,替代了之前的mysql - natlve - password
在default - authentication - plugin,mysql.user中可以看到变化

查看5.7版本中默认的插件
show variables like 'default _ authentication%';
查看8.7版本中的默认插件
方法一:show variables like 'defavlt _ auhentication%';
方法二:select user,host ,plugin from mysql.user;

注:“default _ authentication%”,文件不能动态修改,只能静态修改

查看MySQL的配置文件
more /etc/my.cnf



注:若想继续使用老版本,则去掉图上这一行的注释,重启服务器。

方式二:alter user 'tony'@'%' identified whith mysql _ netive_ password by 'Tony@2019'
在查看一下
select user,host,plugin from mysql,user;



原文地址:访问原文地址
快照地址: 访问文章快照