我正在连接MySQL - 8.0与MySQL工作台和得到以下错误:
无法加载认证插件“caching_sha2_password”: dlopen (/ usr /地方/ mysql / lib /插件/ caching_sha2_password。所以,2):图像 没有找到
我也尝试过其他客户端工具。
有什么解决办法吗?
我正在连接MySQL - 8.0与MySQL工作台和得到以下错误:
无法加载认证插件“caching_sha2_password”: dlopen (/ usr /地方/ mysql / lib /插件/ caching_sha2_password。所以,2):图像 没有找到
我也尝试过其他客户端工具。
有什么解决办法吗?
当前回答
我也遇到了同样的问题,但是Aman Aggarwal的答案在运行mysql 8.X的Docker容器中对我不起作用。 我登录了集装箱
docker exec -it CONTAINER_ID bash
然后以root用户登录mysql
mysql --user=root --password
输入root密码(默认为'root') 最后运行:
ALTER USER 'username' IDENTIFIED WITH mysql_native_password BY 'password';
你都准备好了。
其他回答
这是我在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 |
+---+
我得到了错误error 2059 (HY000):身份验证插件“caching_sha2_password”无法加载:/usr/lib64/mysql/plugin/caching_sha2_password。so:不能打开共享对象文件:没有这样的文件或目录。原来是我自己的错;我把用户名打错了。一旦我纠正了错字,我就可以很好地连接了。
以下是在Windows 10上安装MySQL 8.0后对我有效的解决方案。
假设MySQL用户名为root,密码为admin
打开命令提示符,输入以下命令:
cd C:\Program Files\MySQL\MySQL Server 8.0\bin Mysql_upgrade -uroot -padmin Mysql -uroot -padmin ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY “管理”
刚刚下载了最新的mysqlworkbench,它与最新的加密兼容:
https://downloads.mysql.com/archives/workbench/
注意:在Mac big Sur上,最新的两个版本:8.0.22和8.0.23是错误的,不能工作。
使用8.0.21直到这些问题得到解决
我在M1 (arm64)中运行docker,在docker bash中直接更改的方式不适合我。相反,我将mysql映像更改为 mysql: 8.0.26 平台设置为 linux / x86_64 在my.cnf中添加default_authentication_plugin=mysql_native_password 然后,重新构建容器。