欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MySQL root用户不能为普通用户赋权限

程序员文章站 2022-05-14 21:13:52
...

MySQL root用户不能为普通用户赋权限,

报错:Error Code: 1044. Access denied for user ‘root’@’%’ to database

mysql> select host,user,password,Grant_priv,Super_priv FROM mysql.user;
+--------------+---------+-------------------------------------------+------------+------------+
| host         |   user     | Grant_priv | Super_priv |
+--------------+---------+-------------------------------------------+------------+------------+
| 192.168.10.% | zzh   | N          | Y          |
| 192.168.10.% | he    | N          | Y          |
| 192.168.10.% | root  | Y          | Y          |
| localhost    | sdvv  | N          | N          |
| localhost    | root  | Y          | Y          |
| %            | root  | N          | Y          |
| 127.0.0.1    | root  | Y          | Y          |
| %            | sdvv  | N          | Y          |
+--------------+---------+-------------------------------------------+------------+------------+

可以看到root远程授权的权限没有打开:

 %            | root  | N   

赋值一下权限即可。

update mysql.user set Grant_priv='Y', Super_priv='Y' where User='root';
flush privileges;
相关标签: access denied