代码之家  ›  专栏  ›  技术社区  ›  Faheem Hassan Zunjani

MySQL错误:无法加载身份验证插件“caching\u sha2\u password”

  •  15
  • Faheem Hassan Zunjani  · 技术社区  · 6 年前

    我刚刚在macOS v10上安装了MySQL版本14.14发行版5.7.22和自制软件。13.4。
    我运行了命令:
    brew install mysql

    安装完成后,在自制软件的指导下,我运行了以下命令:
    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中将default\u authentication\u plugin更改为mysql\u native\u密码。但它仍然抛出相同的错误。

    接下来我试着跑步:
    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.

    非常感谢您的帮助。

    4 回复  |  直到 6 年前
        1
  •  3
  •   W Kristianto    6 年前

    因此,我通过 sudo lsof -i tcp:3306 然后我用 sudo kill -9 <PID>

    在这之后我试着 mysql_secure_installation 再次,但遇到了新错误:

    错误:无法通过套接字“/tmp/MySQL”连接到本地MySQL服务器。袜子’(61)

    在尝试了一些获取mysql的修复之后。为了工作,我启动了MySQL服务器 sudo mysql.server start 然后继续 mysql\u secure\u安装 为根用户设置密码。

    这终于对我起作用了。

    注意:Homebrew要求您首先执行以下操作 mysql\u secure\u安装 在第一次启动MySQL服务器之前,这让我陷入了无尽的错误循环。

        2
  •  0
  •   井上智文    6 年前

    重新启动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
    

    Try in PWD

    关联一个问题。

    Authentication plugin 'caching_sha2_password' cannot be loaded

        3
  •  0
  •   Waweru Mwaura    6 年前

    我发现这应该是安装的mysql版本的问题。正如上面所述,您应该首先找到然后杀死连接在端口3306上的mysqld进程

    sudo lsof -i tcp:3306
    sudo kill -9 <Peocess ID>
    

    然后通过brew升级mysql安装,在这种情况下:

    brew upgrade mysql
    

    这应该可以解决问题。升级后运行mysql应该在安装后启动服务器。

    e、 g级 mysql -u root -p [your password here]

        4
  •  0
  •   Ian    4 年前

    我在Sequel Pro尝试通过SSH连接到本地安装了MySQL的AWS Ubuntu服务器时遇到了这个错误。

    我使用的是一个非root MySQL用户,它给了我这个错误。当我使用root用户和密码运行它时,它就工作了。