mysql将某数据库的全部权限赋给某⽤户,提⽰1044错误
Accessdenied
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⽤户不能授权给其他⽤户,所以我们需要把这个值改为Yaccess转mysql教程视频
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>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论