dongxt

MySQL更新到8.0以上版本后,在创建连接远程的用户的时候和之前5.x的版本有了很大的不同,不能使用原来同时创建用户和授权的命令。

以下是记录的MySQL8.0创建用户并授权的命令:

  1. 查看用户表:
user mysql;
select host,user,authentication_string,plugin from user;

image-20210614213712146

  1. 创建可远程连接用户
mysql>create user dongxt@\'%\' identified by \'password\';
  1. 给用户授权
mysql>grant all privileges on *.* to dongxt@\'%\' with grant option;
  1. 刷新权限
mysql>flush privileges;
  1. 修改远程连接用户的加密规则
mysql>alter user dongxt@\'%\' identified with mysql_native_password by \'password\';

image-20210614214530553

分类:

技术点:

相关文章: