连接到MySQL数据库时身份验证插件错误 [英] Authentication plugin error while connecting to MySQL database

查看:252
本文介绍了连接到MySQL数据库时身份验证插件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用macOS版本10.13.5-实际上是最新版本.

I am working on macOS ver 10.13.5 - the newest one actually.

我通常与Laravel项目(5.6)一起工作,因此我正在使用Brew服务更加出色地使本地环境正常工作.

I usually work with Laravel projects (5.6), and so I am using brew services isntaller to make local enviroment working.

我正在2.0.12版中使用PHP v 7.1.16,MySQL 8.0.11和Valet

PHP和MySQL.

PHP and MySQL installed through Brew.

过去3个月来我一直没有遇到任何问题,但是终于有了必须重新安装操作系统的那一天.

I've been working without any problems for like 3 months in the past, but the day when I had to reinstall my os finally come.

使用全新副本重新安装macOS,并以与以前相同的版本安装每个服务后,在尝试通过SequelPro连接到MySQL数据库时遇到一些奇怪的错误.

After reinstalling macOS with the fresh copy, and installing each service in the same version as it's been before, I am getting some weird error while trying to connect to the MySQL database through SequelPro.

以下是一些日志:

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

这很奇怪,因为我一直在使用相同的东西而没有任何问题...

That's weird, as I've been working with the same stuff without any problems for quite a while...

因此,对于任何有关如何解决此问题的建议,我将不胜感激. 我也想注意到,我已经阅读了几乎所有有关此问题的内容,但是我至少找不到像我这样的配置(大多数人在处理由mysql或MySQL提供的本地数据库时描述了此问题)其他一些服务提供商).

So I'd appreciate any advices on how to deal with this problem. Also I'd like to notice that I've read almost everything about this problem, but I wasn't able to find at least one with configuration like mine (most of them described this problem as while working with local database provided by mysql or some other services provider).

推荐答案

出现此错误消息是因为MySQL v8更改了默认的身份验证插件/方法,该方法与旧客户端没有向后兼容性. 可以通过使用旧版身份验证方法来解决该错误,该方法可以通过执行以下操作为root用户启用:

The error message appears because MySQL v8 changed the default authentication plugin / method, which has no backwards compatibility with older clients. The error can be worked around by using the legacy authentication method, which can be enabled for the root user by doing the following:

在安装MySQL之后,使用CLI进行身份验证,例如

After installing MySQL, authenticate using the CLI e.g

mysql -uroot

然后运行以下命令以使用旧的身份验证方法:

Then run the following command to use the old authentication method:

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

最后,刷新特权:

FLUSH PRIVILEGES;

现在,您应该可以再次使用SequelPro(使用指定的密码)进行连接.

Now you should able to connect using SequelPro again (using the specified password).

这篇关于连接到MySQL数据库时身份验证插件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆