MySQL8.0.16:Access denied
MySQL8.0.16版本中新增了一个system_user帐户类型,当我们新增一个用户test,并用root用户对test进行密码修改的操作时,系统不会报错。
create user 'test'@'localhost' identified by 'test';
set password for 'test'@'localhost' = 'test1';
因为此时用户test还没有被授权。
当用户test被授权后,再使用root对test修改密码:
grant all on *.* to 'test'@'localhost';
set password for 'test'@'localhost' = 'test1';
这个时候系统会报错:
> 1227 - Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation
我查阅了一下官方文档,原因是由于root用户没有SYSTEM_USER权限,把权限加入后即可解决:
grant system_user on *.* to 'root';
然后再修改test密码即可。
发布于 2019-05-24 14:59