Navicat连接MySQL8.0.16报错caching_sha2_password' cannot be loaded

477 阅读1分钟

解决方式

#修改mysql登录设置
[root@localhost ~]#  vim /etc/my.cnf

#在[mysqld]段中加入
skip-grant-tables

#保存之后重启mysql服务
[root@localhost ~]# service mysqld restart

#登录mysql
[root@localhost ~]# mysql -u root -p

#登录后先刷新一下(不然会报错 :ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement)

mysql> flush privileges;
#修改密码
mysql> use mysql;
mysql> alter USER 'root'@'%' IDENTIFIED BY '要修改的密码';

#再刷新一下
mysql> flush privileges;

#删除 skip-grant-tables

#重启mysql

#登录mysql
[root@localhost ~]# mysql -u root -p

mysql> flush privileges;

#给root授予system_user的权限
mysql> grant system_user on *.* to root;

mysql> flush privileges;
mysql> grant system_user on *.* to root;

mysql> use mysql;
##更改加密方式
mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'xxxx' PASSWORD EXPIRE NEVER;
mysql> update user set authentication_string='' where user='root';
##更改密码:
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxx';

mysql> flush privileges;