解决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

 

posted @ 2020-06-19 21:33  莫柔落切  阅读(4034)  评论(0编辑  收藏  举报