win10的docker无法运行mysql的image,Public Key Retrieval is not allowed

一、问题背景

1、在win10版本的docker中,直接点击运行mysql的image,出现无法启动的情况

异常日志:

2021-08-29 01:33:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
2021-08-29 01:33:33+00:00 [Note] [Entrypoint]: Switching to dedicated user ‘mysql‘
2021-08-29 01:33:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
2021-08-29 01:33:33+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of the following:
- MYSQL_ROOT_PASSWORD
- MYSQL_ALLOW_EMPTY_PASSWORD
- MYSQL_RANDOM_ROOT_PASSWORD

win10的docker无法运行mysql的image,Public Key Retrieval is not allowed

2、当使用dbeaver连接时,出现Public Key Retrieval is not allowed异常

二、解决方案

1、初始化mysql密码
docker run -p 3306:3306 --name=mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:latest

2、修改连接属性
将jdbc连接地址中追加,allowPublicKeyRetrieval=true
win10的docker无法运行mysql的image,Public Key Retrieval is not allowed

备注:用mysql官方提供的workbench可以直接连通,无需修改连接属性

win10的docker无法运行mysql的image,Public Key Retrieval is not allowed

上一篇:MyBatis 使用注解开发初体验


下一篇:Flink基础(123):FLINK-SQL语法 (17) DQL(9) OPERATIONS(6) 窗口 (4)Over Aggregation