QNAP phpMyAdmin container: "phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection"

123 Views Asked by At

In a QNAP NAS, there is a MySQL Docker container with:

  • IP address: 10.0.3.3
  • MYSQL_ROOT_PASSWORD: root
  • Port forwarding: 32774 → 33060/TCP

When creating the phpMyAdmin Docker container, I specified:

  • PMA_HOST: 10.0.3.3
  • PMA_PORT: 33060
  • PMA_USER: root
  • PMA_PASSWORD: root

However, when loading phpMyAdmin, there are errors:

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.
1

There are 1 best solutions below

2
zori On

Issue is that default MySQL port is 3306 but you are connecting to 33060, that is the port that should be used in phpMyAdmin for the connection

Additional note looking at https://hub.docker.com/_/mysql, there is no information about default port for MySQL, so we can get it for for example Google What is default port for MySQL server, also we can go to the specific image tag on Docker Hub mysql:latest and look for command EXPOSE, in this case we will get EXPOSE map[3306/tcp:{} 33060/tcp:{}].

Additional thing to mention here is port 33060, if we go deeper we will get it's Port X Portocol and it's not what phpMyAdmin expects (this is what I learned form this)