签到成功

知道了

CNDBA社区CNDBA社区

Mysql 8.0新特性--caching_sha2_password

2018-10-18 16:38 3483 0 原创 MySQL 8.0
作者: Expect-乐

Mysql8.0中默认的密码验证插件变化了,之前是mysql_native_password,现在是caching_sha2_password。caching_sha2_password提供了更好的性能和更高的密码安全性。http://www.cndba.cn/Expect-le/article/3087

如果mysql版本太低会无法连接到Mysql8.0。报错:http://www.cndba.cn/Expect-le/article/3087http://www.cndba.cn/Expect-le/article/3087

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/local/mysql/lib/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

官方给出了客户端和连接器的兼容版本:

  •       The libmysqlclient client library in MySQL 8.0 (8.0.4 or higher). Standard MySQL clients such as mysql and mysqladmin are libmysqlclient-based, so they are compatible as well.
  •       The libmysqlclient client library in MySQL 5.7 (5.7.23 or higher). Standard MySQL clients such as mysql and mysqladmin are libmysqlclient-based, so they are compatible as well.
  •        MySQL Connector/C++ 1.1.11 or higher or 8.0.7 or higher.
  •        MySQL Connector/J 8.0.9 or higher.
  •        MySQL Connector/NET 8.0.10 or higher (through the classic MySQL protocol).
  •        MySQL Connector/Node.js 8.0.9 or higher.
  •        PHP: the X DevAPI PHP extension (mysql_xdevapi) supports caching_sha2_password.

而如果你的客户端版本低于5.7.23,而连接用户又使用了默认的密码验证插件,那么就无法通过该用户连接,只能修改该用户的密码验证插件。

解决方法如下:

http://www.cndba.cn/Expect-le/article/3087
http://www.cndba.cn/Expect-le/article/3087

1)         修改某个用户的验证插件

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

flush privileges;

2)         初始化数据库时,也可以修改默认插件http://www.cndba.cn/Expect-le/article/3087http://www.cndba.cn/Expect-le/article/3087

bin/mysql –initialize --default-authentication-plugin=mysql_native_password

http://www.cndba.cn/Expect-le/article/3087

3)         【推荐】修改配置文件

http://www.cndba.cn/Expect-le/article/3087

[mysqld]

default_authentication_plugin=mysql_native_passwordhttp://www.cndba.cn/Expect-le/article/3087

版权声明:本文为博主原创文章,未经博主允许不得转载。

caching_sha2_password

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
Expect-乐

Expect-乐

关注

Without the continuous bitter cold, there can be no fragrant plum blossom

  • 336
    原创
  • 6
    翻译
  • 100
    转载
  • 41
    评论
  • 访问:1379006次
  • 积分:1957
  • 等级:核心会员
  • 排名:第3名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ