我有这个 yml 文件用于在 docker 中配置 MySQL:
# Use root/example as user/password credentials
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'pass'
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'pass'
adminer:
image: adminer
restart: always
ports:
- 8888:8080
我使用以下命令从 yml 所在的同一目录启动容器:
docker-compose -f stack.yml up
然后我得到了这个错误:
最佳答案
如果您遇到此错误但仍希望使用 MySQL v.8。您可以通过告诉 MySQL Server 使用旧的身份验证插件来做到这一点。
因此,您的撰写文件将如下所示:
# Use root/example as user/password credentials
version: '3.1'
services:
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'pass'
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'pass'
adminer:
image: adminer
restart: always
ports:
- 8888:8080
关于mysql - docker 撰写 : The server requested authentication method unknown to the client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50097032/