解决MySQL8 #1227 – Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this ...

Posted jack4518

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决MySQL8 #1227 – Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this ...相关的知识,希望对你有一定的参考价值。

很奇怪今天MySQL8突然出现一些莫明的错误,比如我昨天在用的帐户,今天操作时报如下错误:

1227 - Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation

具有root权限的用户也报SYSTEM_USER权限不足,如何解决?看下面

mysql8 Access denied解决

MySQL8版本中新增了一个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‘;

这个时候系统会报错:

1> 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密码即可。不因为SYSTEM_USER权限涉及到所有帐户操作,所以不仅是修改密码,修改帐户信息,授权等都会报这个错,解决方法同样是上面的操作。

参考

https://mysqlserverteam.com/the-system_user-dynamic-privilege/

https://zhuanlan.zhihu.com/p/66866225

https://www.uedbox.com/post/64673/



作者:HanssonLiu
链接:https://www.jianshu.com/p/1b565749bdab
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

以上是关于解决MySQL8 #1227 – Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this ...的主要内容,如果未能解决你的问题,请参考以下文章

MySQL用户新建表报1227异常

1227- Access denied; you need (at least one of) the PROCESS privilege(s) for this operation

使用Mysql Workbench 导入数据库提示 ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) t

终极解决 mysql8.0 ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)

51nod1227 平均最小公倍数

mysql8.0,远程连接,navicat创建数据库报错1044-Access denid for user