Authentication plugin error while connecting to MySQL database

淺唱寂寞╮ 提交于 2019-12-18 13:32:16

问题


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

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

I am using PHP v 7.1.16, MySQL 8.0.11 and Valet in v. 2.0.12

PHP and MySQL installed through Brew.

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.

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.

Here's some logs:

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...

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).


回答1:


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:

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';

Lastly, flush the privileges:

FLUSH PRIVILEGES;

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



来源:https://stackoverflow.com/questions/50892720/authentication-plugin-error-while-connecting-to-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!