7

I just installed MySQL Ver 14.14 Distrib 5.7.22 with Homebrew on my macOS v10.13.4.
I ran the command:
brew install mysql

After the installation completed, as directed by Homebrew, I ran the command:
mysql_secure_installation
and was returned the error: Error: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/Cellar/mysql/5.7.22/lib/plugin/caching_sha2_password.so, 2): image not found

I tried a few things like changing default_authentication_plugin to mysql_native_password in the my.cnf file but it still throws the same error.

Next I tried running:
mysql_upgrade -u root
and I was thrown the same error again mysql_upgrade: Got error: 2059: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/Cellar/mysql/5.7.22/lib/plugin/caching_sha2_password.so, 2): image not found while connecting to the MySQL server Upgrade process encountered error and will not continue.

Any help is appreciated.

asked Apr 20, 2018 at 17:00
1

2 Answers 2

5

So, I found the running process of mysqld by sudo lsof -i tcp:3306 then I killed it using sudo kill -9 <PID>.
After this I tried $ mysql_secure_installation again but ran into a new error Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
After trying a few fixes for getting mysql.sock to work, I started the MySQL server with
$ sudo mysql.server start
then went ahead with $ mysql_secure_installation to set password for the root user.

This worked for me finally.

Note: Homebrew asks you to first do mysql_secure_installation before starting the MySQL server for the first time but that just made me run into endless loop of errors.

answered Apr 21, 2018 at 12:51
0
1

I had the same error and solved this by stopping the MySQL server 8.0 from System Preferences -> MySQL settings. I have both the 5.7 and 8.0 installed at the same time.

Now when I type

mysql --version

I get

mysql Ver 14.14 Distrib 5.7.22, for osx10.13 (x86_64)

And I can log in successfully.

answered May 20, 2018 at 14:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.