QNAP phpMyAdmin 容器:“phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝了连接”

问题描述 投票:0回答:1

在 QNAP NAS 中,有一个 MySQL Docker 容器,其中包含:

  • IP地址:10.0.3.3
  • MYSQL_ROOT_PASSWORD:根
  • 端口转发:32774 → 33060/TCP

创建 phpMyAdmin Docker 容器时,我指定:

  • PMA_HOST:10.0.3.3
  • PMA_端口:33060
  • PMA_USER:根
  • PMA_PASSWORD:根

但是加载phpMyAdmin时,出现错误:

Cannot connect: invalid settings.
 mysqli::real_connect(): Premature end of data (mysqlnd_wireprotocol.c:387)
 mysqli::real_connect(): GREET packet 4 bytes shorter than expected
 mysqli::real_connect(): Error while reading greeting packet. PID=30
 mysqli::real_connect(): (HY000/2002): Unknown error while trying to connect via tcp://10.0.3.3:33060
 phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
mysql docker phpmyadmin containers qnap
1个回答
0
投票

我猜问题是默认端口是

3306
但你有
33060
,所以它甚至没有启动连接,因为你在消息中服务器拒绝了连接。它被拒绝,因为它没有监听该端口

附加说明查看https://hub.docker.com/_/mysql,没有有关MySQL默认端口的信息,因此我们可以通过例如Google

What is default port for MySQL server
获取它,我们也可以访问Docker Hub 上的特定镜像标签mysql:latest并查找命令
EXPOSE
,在这种情况下我们将得到
EXPOSE map[3306/tcp:{} 33060/tcp:{}]

这里要提到的额外事情是端口

33060
,但是我更深入地了解它,我们会得到它是 Port X Portocol,这不是 phpMyAdmin 所期望的(这是我从中学到的)

© www.soinside.com 2019 - 2024. All rights reserved.