我是码头工人和容器世界的新手。在我的本地机器上设置 mysql 客户端时遇到问题。我指的是本教程。
我的 docker-compose.yml 文件看起来像
version: "3.7"
services:
db:
image: mysql
container_name: "mySql-wordpress"
restart: always
environment:
MYSQL_ROOT_PASSWORD: p@55w0rD@1234
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
networks:
- back
adminer:
image: adminer
restart: always
ports:
- 8282:8080
networks:
back:
volumes:
db_data:
我能够docker-compose up -d
成功执行命令没有问题。下面是docker ps
命令
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
8ecd82867a06 mysql "docker-entrypoint.s…" 37 seconds ago Up 34 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp
mySql-wordpress
ae01696e6445 adminer "entrypoint.sh docke…" 8 minutes ago Up 7 seconds 0.0.0.0:8282->8080/tcp
ae01696e6445_wordpressdemo_adminer_1
aa7e1055fc99 phpmyadmin/phpmyadmin "/docker-entrypoint.…" 16 minutes ago Up 16 minutes 0.0.0.0:8181->80/tcp
wordpressdemo_phpmyadmin_1
现在,当我尝试登录时,Adminer portal
我收到错误消息
SQLSTATE[HY000] [2002] No such file or directory
我也尝试安装phpmyadmin/phpmyadmin
Image 但出现以下错误:
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
看起来我的 SQL 服务器设置不正确。任何指针?
更新 1
通过图像mysql:5.7
,我可以在下面看到两条错误消息phpMyAdmin
mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known