数据库
首页 > 数据库> > win10的docker无法运行mysql的image,Public Key Retrieval is not allowed

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

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

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

标签:00,01,08,33,image,allowed,Entrypoint,mysql,Retrieval
来源: https://www.cnblogs.com/renguanyu/p/15201952.html