MySQL错误:无法加载身份验证插件"caching_sha2_password"

Fah*_*ani 12 mysql macos macos-high-sierra

我刚刚在我的macOS v10.13.4上安装了MySQL Ver 14.14 Distrib 5.7.22和Homebrew.
我跑了命令:
brew install mysql

安装完成后,按照Homebrew的指示,我运行了命令:
mysql_secure_installation
并返回错误: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

我尝试了一些事情,比如在my.cnf文件中将default_authentication_plugin更改为mysql_native_password,但它仍然会抛出相同的错误.

接下来我试着跑:
mysql_upgrade -u root
我再次抛出同样的错误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.

任何帮助表示赞赏.

Fah*_*ani 3

所以,我找到了 mysqld 的运行进程,然后sudo lsof -i tcp:3306我使用 杀死了它sudo kill -9 <PID>

之后我mysql_secure_installation再次尝试,但遇到了新的错误:

错误:无法通过套接字“/tmp/mysql.sock”连接到本地 MySQL 服务器 (61)

在尝试了一些修复以使 mysql.sock 正常工作后,我启动了 MySQL 服务器,sudo mysql.server start然后继续mysql_secure_installation为 root 用户设置密码。

这最终对我有用。

mysql_secure_installation注意:Homebrew 要求您在第一次启动 MySQL 服务器之前首先执行此操作,但这只是让我遇到了无限循环的错误。