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

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

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

有什么解决办法吗?


当前回答

虽然这不是实数 解决方案,如果你被卡住了,它在本地是有效的

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';

其他回答

像这样的吗?

docker run -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql --default-authentication-plugin=mysql_native_password
mysql -uroot --protocol tcp

试试PWD

https://github.com/GitHub30/docs/blob/change-default_authentication_plugin/mysql/stack.yml

或者你应该使用MySQL Workbench 8.0.11。

如果你像我一样在GitLab上得到这个错误: 只要从最新版本更改到5.7版本即可;)

# .gitlab-ci.yml

rspec:
  services:
    # - mysql:latest (I'm using latest version and it causes error)
    - mysql:5.7 #(then I've changed to this specific version and fix!)

这是我在docker-compose中的数据库定义:

dataBase:
    image: mysql:8.0
    volumes:
        - db_data:/var/lib/mysql
    networks:
        z-net:
            ipv4_address: 172.26.0.2
    restart: always
    entrypoint: ['docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
    environment:
        MYSQL_ROOT_PASSWORD: supersecret
        MYSQL_DATABASE: zdb
        MYSQL_USER: zuser
        MYSQL_PASSWORD: zpass
    ports:
        - "3333:3306"

相关的行是入口点。

在构建和建立它之后,你可以用以下方法测试它:

$ mysql -u zuser -pzpass --host=172.26.0.2  zdb -e "select 1;"
Warning: Using a password on the command line interface can be insecure.
+---+
| 1 |
+---+
| 1 |
+---+

Windows 10:

打开命令提示符:

cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"

C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p
Enter password: *********

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newrootpassword';
Query OK, 0 rows affected (0.10 sec)

mysql> exit

或者,您可以更改my.ini配置如下:

[mysqld]

default_authentication_plugin=mysql_native_password

重新启动MySQL服务器并再次打开Workbench。

在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:不能打开共享对象文件:没有这样的文件或目录

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