Navicat Premium 连接MySQL数据库出现Authentication plugin 'caching_sha2_password' cannot be loaded的解决方案
Navicat Premium 连接MySQL数据库出现Authentication plugin ‘caching_sha2_password’ cannot be loaded的解决方案
Navicat Premium安装了很久了,有段时间没使用,最近想重拾数据库,尝试用Navicat Premium创建一个链接,“Test connection”时提示“Authentication plugin ‘caching_sha2_password’ cannot be loaded”,百度了一阵,找到了方法,记录下供学习参考。
解决方法:
MacOS下:
1、cd到mysql的bin目录下面,Mac默认是/usr/local/mysql
执行命令:mysql -u root -p
Enter password:
输入正确密码:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 8.0.12 MySQL Community Server - GPL
Copyright © 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
2、#修改加密规则
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.06 sec)
3、#更新用户密码
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
Query OK, 0 rows affected (0.10 sec)
4、#刷新权限
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
5、#重置密码
mysql> alter user ‘root’@‘localhost’ identified by ‘此处填上新密码’;
Query OK, 0 rows affected (0.11 sec)
6、exit退出;
7、结束后再返回Navicat Premium 连接MySQL数据库TestConnection成功