当前位置:   article > 正文

Navicat Premium连接不上MySQL,报错:“Authentication plugin 'caching_sha2_password' cannot be loaded……”_navicat premium 16 mysql 是什么原因

navicat premium 16 mysql 是什么原因

在用Navicat Premium连接MySQL数据的时候,会遇到以下错误提示 

Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found 

原因是:安装完MySQL后,root 的密码默认是用 caching_sha2_password 插件加密的。而客户端找不到 caching_sha2_password 插件,于是登录不上。

那这种情况的话就需要修改root密码加密类型,更改为 mysql_native_password

$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

这时候如果是出现了这个错误说明密码的策略不满足要做,需要修改策略。先查询一下MySQL变量中密码的验证方式

我们需要将validate_password.policy修改为LOW

$ set global validate_password.policy=LOW;

在执行以下命令就可以了

$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

 

Docker 中MySQL镜像出现了类型问题解决办法类似 

进入到Docker中mysql容器

$ docker exec -it mysql8 /bin/bash

登录到容器中mysql

  1. root@dbf73b002f97:/# mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 9
  5. Server version: 8.0.17 MySQL Community Server - GPL
  6. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql>

设置权限(为root分配权限,以便可以远程连接) 【可选】

  1. mysql> grant all PRIVILEGES on *.* to root@'%' WITH GRANT OPTION;
  2. Query OK, 0 rows affected (0.01 sec)

 

重置密码规则和密码 

  1. mysql> show variables like '%password%';
  2. +----------------------------------------------+-----------------+
  3. | Variable_name | Value |
  4. +----------------------------------------------+-----------------+
  5. | caching_sha2_password_auto_generate_rsa_keys | ON |
  6. | caching_sha2_password_private_key_path | private_key.pem |
  7. | caching_sha2_password_public_key_path | public_key.pem |
  8. | default_password_lifetime | 0 |
  9. | disconnect_on_expired_password | ON |
  10. | mysql_native_password_proxy_users | OFF |
  11. | password_history | 0 |
  12. | password_require_current | OFF |
  13. | password_reuse_interval | 0 |
  14. | report_password | |
  15. | sha256_password_auto_generate_rsa_keys | ON |
  16. | sha256_password_private_key_path | private_key.pem |
  17. | sha256_password_proxy_users | OFF |
  18. | sha256_password_public_key_path | public_key.pem |
  19. +----------------------------------------------+-----------------+
  20. 14 rows in set (0.00 sec)
  21. [可选]
  22. mysql> grant all PRIVILEGES on *.* to root@'%' WITH GRANT OPTION;
  23. Query OK, 0 rows affected (0.01 sec)
  24. mysql> alter user 'root'@'%' IDENTIFIED by 'password' password expire never;
  25. Query OK, 0 rows affected (0.01 sec)
  26. mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'youpassword';
  27. Query OK, 0 rows affected (0.01 sec)
  28. mysql> flush privileges;
  29. Query OK, 0 rows affected (0.00 sec)
  30. mysql>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/529664
推荐阅读
相关标签
  

闽ICP备14008679号