我正在连接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):图像 没有找到
我也尝试过其他客户端工具。
有什么解决办法吗?
当前回答
虽然这不是实数 解决方案,如果你被卡住了,它在本地是有效的
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
其他回答
PIP卸载mysql-connector
然后安装 PIP安装mysql-connector-python
注意:适用于Linux (Debian, Ubuntu, Mint)
我得到了这个错误:
MySQL Error Message: Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
我通过以下步骤解决了这个问题:
在mysql控制台输入:$ mysql -u root -p,如果你没有root用户的密码,那么: 使用mysql数据库:>使用mysql; mysql> Alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 退出……mysql >退出; 完成了!
这是我在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 |
+---+
对我来说,这种情况开始发生是因为在一个项目中,我正在使用Docker映像mysql:latest(这是版本5,并且工作良好),在后来的构建中,最新版本切换到版本8,并停止工作。我把我的映像改为mysql:5,我不再得到这个错误。
macOS的MySQLWorkbench 8.0.11解决了这个问题。 我可以建立连接与根密码保护mysql实例运行在docker。