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用戶登錄就可以正常新建用戶了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM