Skip to main content

mysql8远程访问权限

一、创建用户和授权

在mysql8.0创建用户和授权和之前不太一样了,其实严格上来讲,也不能说是不一样,只能说是更严格,mysql8.0需要先创建用户和设置密码,然后才能授权。

#先创建一个用户

use mysql;

create user 'arick'@'%' identified by 'Zz20201020qq';


# 修改密码方式登录
ALTER USER `arick`@`%` IDENTIFIED WITH mysql_native_password;

#再进行授权
grant all privileges on *.* to 'arick'@'%' with grant option;
查看是否成功
select host, user, authentication_string, plugin from user;

GRANT ALL PRIVILEGES ON *.* TO 'arick'@'%' IDENTIFIED BY 'Zz20201020qq';

刷新缓存flush privileges;