1. 程式人生 > >root用戶登錄mysql後新建用戶提示1045錯誤

root用戶登錄mysql後新建用戶提示1045錯誤

show user 使用 沒有 root用戶登錄 mysql ide 現在 但是

執行以下命令查看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用戶登錄就可以正常新建用戶了

root用戶登錄mysql後新建用戶提示1045錯誤