root用户登录mysql后新建用户提示1045错误

执行以下命令查看root权限

show grants for 'root'@'localhost';

如果没有显示with grant option,说明是root没有拥有新建授权用户的权限(为什么会这样呢,因为我把user='root' and host='localhost'给删掉了,然后重新授权all privileges给新建root用户,但是没有授权with grant option)

然后我们使用localhost登录再次新建root用户,一定要在后面增加with grant option;

grant all privileges on *.* to 'root'@'localhost'  identified by '123' with grant option;;现在我们再使用root用户登录就可以正常新建用户了

 

posted on 2017-11-09 11:10  标配的小号  阅读(1754)  评论(0编辑  收藏  举报

导航