DSM 7.1 Troubleshooting connection error HY000/2002 when installing phpmyadmin

Currently reading
DSM 7.1 Troubleshooting connection error HY000/2002 when installing phpmyadmin

51
7
NAS
DS920+
Operating system
  1. macOS
  2. Windows
Mobile operating system
  1. Android
  2. iOS
Last edited:
Greetings,

I managed to install docker and portainer on my NAS. When trying to embark on installing infrastructure applications like database (MariaDB) and db front-end phpmyadmin I face the local connection error mysqli::real_connect(): (HY000/2002): Connection timed out) error. I suspect my network settings are the root of this issue. MariaDB container is functional now but the issue is with phpmyadmin. The plan is to install almost all applications , i.e. nextcloud, GIT versioning server, ...etc , via docker images when possible and use a central database server that host databases for each application.

My current network configuration :
  • Telco GPON modem -> POE Switch -> NAS
  • Telco modem provides wired connection only, Wifi disabled
  • UPnP disabled on telcom modem
  • Single NAS device with a static IP (set by telco modem DHCP static IP config.)
  • Port mapping set in modem for external HTTPS access over internet to the local NAS
  • NAS External internet access is provided through Synology DDNS
  • DMZ disabled on the modem for NAS IP
  • NAS default HTTPS port changed
  • NAS default HTTP port not changed yet
  • NAS Firewall enabled and functional
 
. When trying to embark in installing infrastructure applications like database (MariaDB) and db front-end phpmyadmin I face the local connection error mysqli::real_connect(): (HY000/2002):
Both in Docker?

Can you share you container parameters or compose that you used?
 
Can you specify the needed details so that I reply with them when I return home and connect to my NAS ?
 
container parameters
I am using the tutorial at this forum and the container parameters are :
  • Image : Official phpmyadmin image
  • Port Settings > local port number set to 81
  • Environment > PMA_HOST set to 192.168.100.100 (just the IP number no HTTPS no port #)
  • Environment > PMA_PORT set to 8001 (my local port as per attached image)
  • phpmyadmin username : root
  • phpmyadmin user password : same as MYSQL_ROOT_PASSWORD set in the MariaDB container
Thanks Rusty for your help !
 

Attachments

  • running-docker-containers.png
    running-docker-containers.png
    163.1 KB · Views: 67
  • mariadb-container-params.png
    mariadb-container-params.png
    32.6 KB · Views: 67
  • docker-network-settings.png
    docker-network-settings.png
    55.7 KB · Views: 65
Since you are already using Portainer, the easy route would be to just deploy them in a stack using the built-in editor. The docker compose below will give you mariadb+phpmyadmin on port 8081:

-o-
version: "3.9"

services:
# MySQL Service
mysql:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: helloworld
volumes:
- mysqldata:/var/lib/mysql

# PhpMyAdmin Service
phpmyadmin:
image: phpmyadmin/phpmyadmin:5.0
environment:
PMA_HOST: mysql
ports:
- 8081:80

# Volumes
volumes:
mysqldata:

-o-

Please observe, that some of the aging Synology boxes will not run the latest phpmyadmin images based on Apache, due to missing kernel features. The :5.0-tag for phpmyadmin may hence not be needed for your DS920+
 
Thanks @ragnarok for your advice. I managed to install mariadb and phpmyadmin images manually. The connection error persists. Phpmyadmin runs successfully on IP http://192.168.100.100:2323 but still throw HY000/2002 error when logging in using root/password credentials . Here are screenshots from my containers and their settings.
 

Attachments

  • docker-containers-running.png
    docker-containers-running.png
    68.6 KB · Views: 36
  • docker-network-bridge-3-connected-conts.png
    docker-network-bridge-3-connected-conts.png
    46.2 KB · Views: 36
  • mariadb-container-details.png
    mariadb-container-details.png
    41.5 KB · Views: 34
  • phpmyadmin-container-details.png
    phpmyadmin-container-details.png
    45.8 KB · Views: 35
Last edited:
My guess is that your sql server only accepts login on its socket from localhost. Adding MYSQL_ROOT_HOST: "%" to your sql container would allow login from any host and may resolve the issue.
-- post merged: --

And unless you run other sql servers, stick to exposing the standard port 3306, i.e. either expose 3306:3306 or leave out the mapping
 
Last edited:
You have two options:
  • In your phpmyadmin container, add a link to the database container, as the default bridge does not provide service disovery. Once the link is created, the phpymadmin container can access the database in the database container by the alias or container name and the container port. You can use an arbitrary string as alias when creating the link - db would be a well suited alias in this case. Then you can use db:3306 or mariadb:3306 to access the database. Docker deprecated links and recommends to use user defined networks instead (see next option).
  • Create an additional bridge network (=user defined network). Stop both containers. Detach both containers from the bridge network and re-attach both to the new network. User defined networks have a built-in dns-based service discovery, which allows the phpmyadmin container to access the database using the container name and container port, e.g. mariadb:3306.
No experienced docker user would run containers attached to the default bridge network, if thes do then usually just to start one-off containers to test something. Personally, I have four docker hosts with exactly zero containers attached to the bridge network.

Note: if you had taken the docker compose approach like @ragnarok suggested, it would have implicitly created a user defined network and service discovery would have applied right away like.
 
Last edited:
Create an additional bridge network (=user defined network). Stop both containers. Detach both containers from the bridge network and re-attach both to the new network. User defined networks have a built-in dns-based service discovery, which allows the phpmyadmin container to access the database using the container name and container port, e.g. mariadb:3306.
I've chosen this option for better preparation for any future applications as 1st option is deprecated. However, there is already a bridge network created and three containers connected to this bridge network (as in attached image above). Create another bridge network ??
 
Created a new network. Stopped both containers. Detached both containers from the bridge network and re-attach both to the new network. Still same error. I think I am not configuring right the port numbers or missing the correct placement of configuration of any of two containers :confused:

pma-not-logging-me-in.png
:confused:
 
Last edited:
Which hostname and port did you use? You need to configure it from the perspective from inside the phpmyadmin container... And for this container, the database can be reached over the container network both are attached to, using the container name and container port.
 
Which hostname and port did you use? You need to configure it from the perspective from inside the phpmyadmin container... And for this container, the database can be reached over the container network both are attached to, using the container name and container port.
To access phpmyadmin I used now my NAS ip followed by my custom local port 3333 and this is what I see :
 

Attachments

  • access-to-pma-at-port-3333.png
    access-to-pma-at-port-3333.png
    16.4 KB · Views: 48
Please re-read everything I wrote. I gave you the exact hints what needs to be done for which option, and you still do something entirely different. I am not sure what to make of this. You can not just pick parts of a response and ignore other parts and then expect it to still somehow work... I mean you can, but as you see it is getting us nowhere.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

  • Question
Although the topic is very old and you are probably not interested anymore, i'll post my solution here so...
Replies
1
Views
2,048
  • Solved
I have helped myself. Found the culprit of the whole story! Secondary DNS on Ethernet adapters of every...
Replies
17
Views
4,169
And once you start working with more and more containers, you will see that CLI (and in some cases...
Replies
26
Views
17,564
  • Question
off course, I also notified him. I posted it here as well, because I assumed that a broader community...
Replies
2
Views
1,725
What has worked for me is to stop the container, remove the container, optionally remove the image, and...
Replies
5
Views
5,646
It always required cgroups. I doubt following this path will get you anywhere. This path is more...
Replies
7
Views
6,298
  • Question
Pihole UI will not work on 80, as 80 is in use by Synology's nginx (as it is 443), just bind it to some...
Replies
8
Views
10,701

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top