There is no such grant defined for user ‘root’ on host ‘%’

数据库 码拜 8年前 (2016-07-19) 22417次浏览 0个评论

最近看mysql相关书籍,书中介绍了一个Show语句的用法,查看用户所拥有的权限。示例:show grants for bookorama;

得到Grants for bookorama@% …如图所示的结果There is no such grant defined for user 'root' on host '%'

但是本人实际尝试操作后并未达到预期效果。执行的命令为:

mysql> show grants for root;

结果提示:There is no such grant defined for user ‘root’ on host ‘%’。搜索了一下原因,说是要根据user表数据。直接for root用户会默认@’%’所以执行不成功,将mysql.user表中的user信息查询出来,带上host信息即可。

修改为mysql> show grants for root@localhost;结果显示正常了,如书中所讲上图结果。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明There is no such grant defined for user ‘root’ on host ‘%’
喜欢 (4)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!