環球觀察:you need (at least one of) the RELOAD privilege(s) for this operation

2023-02-06 10:32:05 來源:51CTO博客


(資料圖片僅供參考)

問題:新搭建的mysql5.6.20,默認沒有密碼直接輸入mysql回車進行登錄:mysql將root@"localhost"改為root@"%"update mysql.user set host="%" where user="root" and host="localhost";退出重新登錄:mysql -uroot -p123456會直接報錯賬號密碼錯誤,這時候直接輸入mysql回車還可以登錄再執行:select user,host from mysql.user;直接報錯:Access denied; you need (at least one of) the RELOAD privilege(s) for this operation解決辦法:因為root@"localhost" 改為root@"%"可以使用mysql -uroot -p123456 -h 192.168.10.130登錄然后重新創建root@"localhost"賬號grant all on *.* to root@"localhost" identified by "123456" with grant option;flush privileges;這樣子既可以遠程登錄root也可以本機直接登錄猜想:將root@"localhost" 改為root@"%",host里面沒有做業務ip和主機名之間的映射

標簽: 直接輸入 遠程登錄 重新登錄

上一篇:
下一篇: