我正在连接MySQL - 8.0与MySQL工作台和得到以下错误:

无法加载认证插件“caching_sha2_password”: dlopen (/ usr /地方/ mysql / lib /插件/ caching_sha2_password。所以,2):图像 没有找到

我也尝试过其他客户端工具。

有什么解决办法吗?


当前回答

我在M1 (arm64)中运行docker,在docker bash中直接更改的方式不适合我。相反,我将mysql映像更改为 mysql: 8.0.26 平台设置为 linux / x86_64 在my.cnf中添加default_authentication_plugin=mysql_native_password 然后,重新构建容器。

其他回答

您可以像这样更改密码的加密。

ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

你可以用下面的Alter命令改变用户密码的加密:

ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY “密码”;

OR

我们可以通过使用old password插件来避免这个错误:

首先修改my.cnf文件中的认证插件,用于Linux / Windows中的my.ini文件:

(mysqld) default_authentication_plugin = mysql_native_password

重新启动mysql服务器以使更改生效,并尝试通过mysql连接任何mysql客户端。

如果仍然无法连接并得到以下错误:

Unable to load plugin 'caching_sha2_password'

这意味着你的用户需要上面的插件。所以尝试在修改默认插件后用create user或grant命令创建新用户。然后新用户需要本地插件,你将能够连接MySQL。

谢谢

PIP卸载mysql-connector

然后安装 PIP安装mysql-connector-python

我发现

ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY 'password';

它不能自己起作用。我还需要设置

[mysqld]
    default_authentication_plugin=mysql_native_password

在/etc/mysql/mysql.conf.d / mysqld.cnf Ubuntu 18.04运行PHP 7.0

在Debian 11中,我有mariadb-client-10.3 MySQL客户端,我有以下错误:

错误1045 (28000):Plugin caching_sha2_password cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/ Plugin /caching_sha2_password. txtso:不能打开共享对象文件:没有这样的文件或目录

我通过升级系统解决了这个问题。