• mysql将某数据库的全部权限赋给某用户,提示1044错误Access denied


    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
    ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'zabbix'

    查看root用户有没有授权权限

    mysql> select host,user,grant_priv,Super_priv from mysql.user;
    +-----------+----------+------------+------------+
    | host      | user     | grant_priv | Super_priv |
    +-----------+----------+------------+------------+
    | 127.0.0.1 | root     | Y          | Y          |
    | localhost | root     | N          | Y          |
    | 10.0.3.%  | repluser | N          | N          |
    +-----------+----------+------------+------------+
    3 rows in set (0.00 sec)


    可以看到localhost的grant_priv的值为N,也就是说root用户不能授权给其他用户,所以我们需要把这个值改为Y

    mysql> update mysql.user set grant_priv='N' where host='localhost';
    Query OK, 0 rows affected (0.00 sec)
    Rows matched: 1  Changed: 0  Warnings: 0
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)


    改完之后最好重启一下服务器(我没重启,所以还是报那个错,重启后就正常了)

    mysql> select user,host,Grant_priv,super_priv from mysql.user;
    +----------+-----------+------------+------------+
    | user     | host      | Grant_priv | super_priv |
    +----------+-----------+------------+------------+
    | root     | 127.0.0.1 | Y          | Y          |
    | root     | localhost | Y          | Y          |
    | repluser | 10.0.3.%  | N          | N          |
    +----------+-----------+------------+------------+
    3 rows in set (0.00 sec)
    
    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> 



  • 相关阅读:
    CSS样式
    hdu 6038 Function
    hdu 6034 Balala Power!
    错排公式 (递推)
    快速求排列组合 lucas定理
    fzu Problem 2275 Game(kmp)
    HDU 3635 Dragon Balls(并查集)
    HDU 3172 Virtual Friends(map+并查集)
    hdu 2818 Building Block(并查集,有点点复杂)
    hdu 1272 小希的迷宫(并查集)
  • 原文地址:https://www.cnblogs.com/biaopei/p/8376941.html
Copyright © 2020-2023  润新知