zoukankan      html  css  js  c++  java
  • [mysql] [navicate] 1251

    [mysql] [navicate] 1251 - Client does not support authentication protocol requested by server

    客户端使用navicat for mysql。本地安装了mysql 8.0。但是在链接的时候提示:

    1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

    主要原因是mysql服务器要求的认证插件版本与客户端不一致造成的。

    打开mysql命令行输入如下命令查看,系统用户对应的认证插件:

    select user, plugin from mysql.user;
    

    img

    可以看到root用户使用的plugin是caching_sha2_password,mysql官方网站有如下说明:

    Important

    The caching_sha2_password authentication plugin on the server requires new versions of connectors and clients, which add support for the new MySQL 8.0 default authentication.

    意思是说caching_sha2_password是8.0默认的认证插件,必须使用支持此插件的客户端版本。

    plugin的作用之一就是处理后的密码格式和长度是不一样的,类似于使用MD5加密和使用base64加密一样对于同一个密码处理后的格式是不一样的。

    解决方法:

    我不希望更新本地的客户端版本,想直接使用原来的环境来链接。

    解决方法是将root的plugin改成mysql_native_password。相当于降了一级。

    mysql官方网站提供了从mysql_old_password升级到mysql_native_password,我们可以仿照这个。

    alter user 'root'@'%' identified with mysql_native_password by "123456";
    flush privileges;
    

    这行代码有两层含义,第一:修改root的密码为'root',摒弃原来的旧密码。第二:使用mysql_native_password对新密码进行编码。

    修改完成后再用客户端登陆成功:

    img

    成功!

  • 相关阅读:
    Java 面向对象(七)多态
    Java 面向对象(六)接口
    Java 面向对象(五)抽象
    JavaScript 之 String 对象
    JavaScript 之 基本包装类型
    JavaScript 之 Array 对象
    【LeetCode-数组】三数之和
    【LeetCode-数组】加一
    【LeetCode-数组】搜索插入位置
    【LeetCode-数组】删除排序数组中的重复项
  • 原文地址:https://www.cnblogs.com/ryxiong-blog/p/12518573.html
Copyright © 2011-2022 走看看