1045- Navicat 连接mysql8异常

1045- Navicat 连接mysql8异常


作者:xjl271314
来源:CSDN
原文:https://blog.csdn.net/xjl271314/article/details/80550765
版权声明:本文为博主原创文章,转载请附上博文链接!

问题描述:
1:Authentication plugin ‘caching_sha2_password’ cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

原因是MySQL8.0版本的加密方式和MySQL5.0的不一样,连接会报错。

试了很多种方法,终于找到一种可以实现的:

更改加密方式

1.先通过命令行进入mysql的root账户:

mysql -uroot -p

再输入root的密码:

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.15 Homebrew

Copyright (c) 2000, 2019, 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.更改密码永不过期:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

3.更改密码:
下方代码的‘password’ 改成你自己的密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

4.刷新:

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

再次尝试,Navicat 连接成功。

ps:我本人环境是mac,通过brew安装的mysql,所以mac的偏好设置下没有mysql的Panel。
如果朋友通过下载dmg文件安装的mysql,可以参考下面这片文章:
https://blog.csdn.net/java_yes/article/details/80104803

你可能感兴趣的:(数据库)