美文网首页
mysql8-2059 Authentication plugi

mysql8-2059 Authentication plugi

作者: 有梦南柯 | 来源:发表于2018-12-08 13:33 被阅读0次

    mac上用homebrew安装mysql步骤:

    1.brew install mysql(默认安装mysql8)

    安装完成后:启动mysql服务

    2.bash mysql.server start

    这个时候用navicat 连接会报错2059 Authentication plugin 'caching_sha2_password' cannot be loaded

    这是因为新版mysql数据库的加密方式变了:

    3.登录数据库 mysql -u root -p

    4.通过命令 select user,plugin from user where user='root'; 我们可以发现加密方式是caching_sha2_password

    5.然后使用命令:alter user 'root'@'%' identified with mysql_native_password by 'your password';

    执行这个语句时如果报错“ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'”,就执行第6步,如果没报错就走第7步

    6.保留当前窗口,新打开一个窗口,重新进入mysql,执行该命令就可以了

    再次查看,就发现加密方式已经更改:

    7.接着找到my.cnf文件(不知道目录的可以通过brew list mysql来确定目录)并加上加密方式:

    default_authentication_plugin=mysql_native_password

    8.保存后,重启mysql服务命令:mysql.server restart

                                        请各位看官轻喷,如果有疑问的可以留言交流。

    相关文章

      网友评论

          本文标题:mysql8-2059 Authentication plugi

          本文链接:https://www.haomeiwen.com/subject/lluxhqtx.html