解決mysql8報錯:ERROR 1410 (42000): You are not allowed to create a user with GRANT


 

新安裝Ubuntu20服務版,

安裝mysql8 后

使用以下語句更改密碼

update mysql.user set authentication_string='password' where user='root';

出現show databases,不能使用。

最后無法只能重新安裝mysql 

_____________________

查看MySQL的依賴項:dpkg --list|grep mysql
卸載: sudo apt-get remove mysql-common
卸載:sudo apt-get autoremove --purge mysql-server
清除殘留數據:dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P
再次查看MySQL的剩余依賴項:dpkg --list|grep mysql
繼續刪除剩余依賴項,如:sudo apt-get autoremove --purge mysql-apt-config
至此已經沒有了MySQL的依賴項
再刪除目錄
sudo rm /var/lib/mysql/ -R # 刪除數據庫目錄
sudo rm /etc/mysql/ -R #刪除啟動腳本、配置文件等
sudo apt-get autoremove mysql* --purge # 卸載mysql所有文件
sudo apt-get remove apparmor # 這個apparmor是在裝mysql-server時裝上的,和安全有關

 

_________________________________

 

重新安裝后,使用

ALTER user 'root'@'localhost' IDENTIFIED BY 'root';  

更改密碼。show databases,正常 

#授權所有權限 開啟遠程連接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
flush privileges;
但是出現另一個錯誤 

ERROR 1410 (42000): You are not allowed to create a user with GRANT

查詢后解決:

update user set host='%' where user='root';

再執行兩次
Grant all privileges on test.* to 'test'@'%';
成功:
但連接Navicat報錯
4.修改加密方式:
alter user test identified with mysql_native_password by 'xxx';
再試,搞定!
 
 
參考:

原文鏈接:https://blog.csdn.net/qq_34680444/article/details/86238516

 


免責聲明!

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



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