MySQL Error: Authentication plugin 'caching_sha2_password' cannot be loaded
MySQL Error: Authentication plugin 'caching_sha2_password' cannot be loaded
我刚刚在我的 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.
感谢任何帮助。
重新启动 mysql 服务器以使更改生效并尝试通过 mysql 与任何 mysql 客户端连接。
否则使用docker
docker run -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql --default-authentication-plugin=mysql_native_password
mysql -uroot --protocol tcp
相关问题。
所以,我通过 sudo lsof -i tcp:3306
找到了 mysqld 的 运行 进程,然后我使用 sudo kill -9 <PID>
杀死了它。
在此之后我再次尝试 mysql_secure_installation
,但是 运行 出现了新的错误:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
在尝试了一些让 mysql.sock 工作的修复之后,我用 sudo mysql.server start
启动了 MySQL 服务器,然后继续使用 mysql_secure_installation
为 root 设置密码用户。
这终于对我有用了。
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.
我发现这应该是安装的 mysql 版本的问题。就像上面一样,你应该首先找到然后杀死附加在端口 3306
上的 mysqld 进程
sudo lsof -i tcp:3306
sudo kill -9 <Peocess ID>
然后通过brew升级mysql安装,本例为:
brew upgrade mysql
这应该解决 it.Running mysql 升级后应该在安装后启动您的服务器。
例如mysql -u root -p [your password here]
我在 Sequel Pro 尝试通过 SSH 连接到本地安装 MySQL 的 AWS Ubuntu 服务器时遇到此错误。
我使用的是非 root MySQL 用户,它给了我那个错误。当我使用 root 用户和密码 运行 它时它起作用了。
我刚刚在我的 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.
感谢任何帮助。
重新启动 mysql 服务器以使更改生效并尝试通过 mysql 与任何 mysql 客户端连接。
否则使用docker
docker run -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql --default-authentication-plugin=mysql_native_password
mysql -uroot --protocol tcp
相关问题。
所以,我通过 sudo lsof -i tcp:3306
找到了 mysqld 的 运行 进程,然后我使用 sudo kill -9 <PID>
杀死了它。
在此之后我再次尝试 mysql_secure_installation
,但是 运行 出现了新的错误:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
在尝试了一些让 mysql.sock 工作的修复之后,我用 sudo mysql.server start
启动了 MySQL 服务器,然后继续使用 mysql_secure_installation
为 root 设置密码用户。
这终于对我有用了。
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.
我发现这应该是安装的 mysql 版本的问题。就像上面一样,你应该首先找到然后杀死附加在端口 3306
上的 mysqld 进程sudo lsof -i tcp:3306
sudo kill -9 <Peocess ID>
然后通过brew升级mysql安装,本例为:
brew upgrade mysql
这应该解决 it.Running mysql 升级后应该在安装后启动您的服务器。
例如mysql -u root -p [your password here]
我在 Sequel Pro 尝试通过 SSH 连接到本地安装 MySQL 的 AWS Ubuntu 服务器时遇到此错误。
我使用的是非 root MySQL 用户,它给了我那个错误。当我使用 root 用户和密码 运行 它时它起作用了。