[GH-ISSUE #1905] Trying to run NPM and I get this error: error getaddrinfo EAI_AGAIN mariadb #1386

Closed
opened 2026-02-26 07:30:46 +03:00 by kerem · 12 comments
Owner

Originally created by @newbieraf on GitHub (Mar 3, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1905

Hi All

First time posting here and a Linux newbie in general. I am running Docker and portainer on a Vultur cloud instance using Ubuntu. Essentially I am getting the "bad gateway" error when trying to log into NPM admin panel but upon digging in further I can see the error below when getting logs from the NPM container:

error getaddrinfo EAI_AGAIN mariadb

Ive made sure that the NPM container can ping the Maria container and the logs show that Maria DB is infact connecting without issue however I cannot work out what the above error means. Any hints? Below is my docker compose (without passwords)

Version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format :
- '8080:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
environment:
DB_MYSQL_HOST: "mariadb"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "XXX"
DB_MYSQL_NAME: "npm"
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db

db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'XXX'
volumes:
- ./data/mysql:/var/lib/mysql

Originally created by @newbieraf on GitHub (Mar 3, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1905 Hi All First time posting here and a Linux newbie in general. I am running Docker and portainer on a Vultur cloud instance using Ubuntu. Essentially I am getting the "bad gateway" error when trying to log into NPM admin panel but upon digging in further I can see the error below when getting logs from the NPM container: error getaddrinfo EAI_AGAIN mariadb Ive made sure that the NPM container can ping the Maria container and the logs show that Maria DB is infact connecting without issue however I cannot work out what the above error means. Any hints? Below is my docker compose (without passwords) Version: "3" services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: # These ports are in format <host-port>:<container-port> - '8080:80' # Public HTTP Port - '443:443' # Public HTTPS Port - '81:81' # Admin Web Port # Add any other Stream port you want to expose # - '21:21' # FTP environment: DB_MYSQL_HOST: "mariadb" DB_MYSQL_PORT: 3306 DB_MYSQL_USER: "npm" DB_MYSQL_PASSWORD: "XXX" DB_MYSQL_NAME: "npm" # Uncomment this if IPv6 is not enabled on your host # DISABLE_IPV6: 'true' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt depends_on: - db db: image: 'jc21/mariadb-aria:latest' restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: 'npm' MYSQL_DATABASE: 'npm' MYSQL_USER: 'npm' MYSQL_PASSWORD: 'XXX' volumes: - ./data/mysql:/var/lib/mysql
kerem 2026-02-26 07:30:46 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@the1ts commented on GitHub (Mar 4, 2022):

Looks like you've changed the DB_MYSQL_HOST to mariadb, but the service for mariadb is still called db: those need to match up.

<!-- gh-comment-id:1059172560 --> @the1ts commented on GitHub (Mar 4, 2022): Looks like you've changed the DB_MYSQL_HOST to mariadb, but the service for mariadb is still called db: those need to match up.
Author
Owner

@newbieraf commented on GitHub (Mar 4, 2022):

Thank you @the1ts where do I need to change that - I cant see it

<!-- gh-comment-id:1059286377 --> @newbieraf commented on GitHub (Mar 4, 2022): Thank you @the1ts where do I need to change that - I cant see it
Author
Owner

@the1ts commented on GitHub (Mar 4, 2022):

You have taken the config from the full system page but changed DB_MYSQL_HOST: "db" to DB_MYSQL_HOST: "mariadb" in only one place. This change is what broke your config.

The DB_MYSQL_HOST value needs to point to the name of the service given in the mariadb section of the docker compose yaml. So in your config above the service is set to db:

db:  
    image: 'jc21/mariadb-aria:latest'

so DB_MYSQL_HOST:"db" will work and DB_MYSQL_HOST:"mariadb" will error as you see.

The easiest fix is just revert your change back to DB_MYSQL_HOST:"db"

<!-- gh-comment-id:1059314894 --> @the1ts commented on GitHub (Mar 4, 2022): You have taken the config from the full system page but changed `DB_MYSQL_HOST: "db"` to `DB_MYSQL_HOST: "mariadb"` in only one place. This change is what broke your config. The `DB_MYSQL_HOST` value needs to point to the name of the service given in the mariadb section of the docker compose yaml. So in your config above the service is set to db: ``` db: image: 'jc21/mariadb-aria:latest' ``` so `DB_MYSQL_HOST:"db"` will work and `DB_MYSQL_HOST:"mariadb"` will error as you see. The easiest fix is just revert your change back to `DB_MYSQL_HOST:"db"`
Author
Owner

@newbieraf commented on GitHub (Mar 4, 2022):

Got it thank you, Ive now changed DB_MYSQL_HOST back to "db" and kept everything else as default just for testing. I am now getting Access denied for user 'npm' which I guess is one step further.

For security obviously I need to change the default username and password, however for testing purposes it should still work correct?

<!-- gh-comment-id:1059319353 --> @newbieraf commented on GitHub (Mar 4, 2022): Got it thank you, Ive now changed DB_MYSQL_HOST back to "db" and kept everything else as default just for testing. I am now getting Access denied for user 'npm' which I guess is one step further. For security obviously I need to change the default username and password, however for testing purposes it should still work correct?
Author
Owner

@newbieraf commented on GitHub (Mar 5, 2022):

@the1ts any help would be appreciated

<!-- gh-comment-id:1059775968 --> @newbieraf commented on GitHub (Mar 5, 2022): @the1ts any help would be appreciated
Author
Owner

@the1ts commented on GitHub (Mar 5, 2022):

Not a huge amount to go on, but I'm guessing you haven't cleared out the DB files in data/mysql this means that the DB is starting with the old credentials. You can battle to change that yourself or do a fresh install.
I believe that the MYSQL_PASSWORD is set at first run only so remove the db files and set the MYSQL_PASSWORD and DB_MYSQL_PASSWORD to the new secure password.
This will get you back to first run and have to setup the username and password again, but it sounds like you have nothing to lose by doing a fresh install.

<!-- gh-comment-id:1059788993 --> @the1ts commented on GitHub (Mar 5, 2022): Not a huge amount to go on, but I'm guessing you haven't cleared out the DB files in data/mysql this means that the DB is starting with the old credentials. You can battle to change that yourself or do a fresh install. I believe that the MYSQL_PASSWORD is set at first run only so remove the db files and set the MYSQL_PASSWORD and DB_MYSQL_PASSWORD to the new secure password. This will get you back to first run and have to setup the username and password again, but it sounds like you have nothing to lose by doing a fresh install.
Author
Owner

@newbieraf commented on GitHub (Mar 5, 2022):

Got it, I’ll. blow away the container inc any persistent directories and start again

<!-- gh-comment-id:1059789453 --> @newbieraf commented on GitHub (Mar 5, 2022): Got it, I’ll. blow away the container inc any persistent directories and start again
Author
Owner

@newbieraf commented on GitHub (Mar 9, 2022):

@the1ts thank you for your help ive tried the following with the same result (error) but this time let me give a bit more detail.

  1. Completly removing both containers and deleting all persistent directories associated, and re-creating from scratch per the above docker-compose file (but changing passwords as you have advised above( That didn't work (error below)
  2. This time just deleting the MySQL directory, then running the compose file again to recreate again with secure passwords. Same result with the same error:

From the DB container:

[i] pre-init.d - processing /scripts/pre-init.d/01_secret-init.sh
[i] mysqld not found, creating....
[i] MySQL data directory not found, creating initial DBs
[i] Creating database: npm
[i] with character set: 'utf8' and collation: 'utf8_general_ci'
[i] Creating user: npm with password Dio8WBeAfijvJTcz6Cqa
2022-03-09 15:10:11 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 52 ...
2022-03-09 15:10:11 0 [Note] Plugin 'InnoDB' is disabled.
2022-03-09 15:10:11 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-03-09 15:10:11 1 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode.
2022-03-09 15:10:11 1 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode.
2022-03-09 15:10:11 1 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode.
2022-03-09 15:10:11 1 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode.
/scripts/run.sh: ignoring or entrypoint initdb empty /docker-entrypoint-initdb.d/*
MySQL init process done. Ready for start up.
exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0
2022-03-09 15:10:11 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ...
2022-03-09 15:10:12 0 [Note] Plugin 'InnoDB' is disabled.
2022-03-09 15:10:12 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-03-09 15:10:12 0 [Note] Server socket created on IP: '::'.
2022-03-09 15:10:12 0 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode.
2022-03-09 15:10:12 0 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode.
2022-03-09 15:10:12 0 [Note] Reading of all Master_info entries succeeded
2022-03-09 15:10:12 0 [Note] Added new Master_info '' to hash table
2022-03-09 15:10:12 0 [Note] /usr/bin/mysqld: ready for connections.
Version: '10.4.15-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server
2022-03-09 15:10:14 3 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES)
2022-03-09 15:10:15 4 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES)
2022-03-09 15:10:16 5 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES)

From the App container:

[3/9/2022] [3:16:25 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES)
[3/9/2022] [3:16:26 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES)
[3/9/2022] [3:16:27 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES)

I am using portainer just in case that makes a difference.

Thanks

<!-- gh-comment-id:1063028124 --> @newbieraf commented on GitHub (Mar 9, 2022): @the1ts thank you for your help ive tried the following with the same result (error) but this time let me give a bit more detail. 1. Completly removing both containers and deleting all persistent directories associated, and re-creating from scratch per the above docker-compose file (but changing passwords as you have advised above( That didn't work (error below) 2. This time just deleting the MySQL directory, then running the compose file again to recreate again with secure passwords. Same result with the same error: From the DB container: [i] pre-init.d - processing /scripts/pre-init.d/01_secret-init.sh [i] mysqld not found, creating.... [i] MySQL data directory not found, creating initial DBs [i] Creating database: npm [i] with character set: 'utf8' and collation: 'utf8_general_ci' [i] Creating user: npm with password Dio8WBeAfijvJTcz6Cqa 2022-03-09 15:10:11 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 52 ... 2022-03-09 15:10:11 0 [Note] Plugin 'InnoDB' is disabled. 2022-03-09 15:10:11 0 [Note] Plugin 'FEEDBACK' is disabled. 2022-03-09 15:10:11 1 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode. 2022-03-09 15:10:11 1 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode. 2022-03-09 15:10:11 1 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode. 2022-03-09 15:10:11 1 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode. /scripts/run.sh: ignoring or entrypoint initdb empty /docker-entrypoint-initdb.d/* MySQL init process done. Ready for start up. exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 2022-03-09 15:10:11 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ... 2022-03-09 15:10:12 0 [Note] Plugin 'InnoDB' is disabled. 2022-03-09 15:10:12 0 [Note] Plugin 'FEEDBACK' is disabled. 2022-03-09 15:10:12 0 [Note] Server socket created on IP: '::'. 2022-03-09 15:10:12 0 [Warning] 'user' entry '@3b2780982056' ignored in --skip-name-resolve mode. 2022-03-09 15:10:12 0 [Warning] 'proxies_priv' entry '@% root@3b2780982056' ignored in --skip-name-resolve mode. 2022-03-09 15:10:12 0 [Note] Reading of all Master_info entries succeeded 2022-03-09 15:10:12 0 [Note] Added new Master_info '' to hash table 2022-03-09 15:10:12 0 [Note] /usr/bin/mysqld: ready for connections. Version: '10.4.15-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server 2022-03-09 15:10:14 3 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES) 2022-03-09 15:10:15 4 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES) 2022-03-09 15:10:16 5 [Warning] Access denied for user 'npm'@'172.18.0.3' (using password: YES) From the App container: [3/9/2022] [3:16:25 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES) [3/9/2022] [3:16:26 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES) [3/9/2022] [3:16:27 PM] [Global ] › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'npm'@'172.18.0.3' (using password: YES) I am using portainer just in case that makes a difference. Thanks
Author
Owner

@Rodrigolmti commented on GitHub (May 9, 2022):

Having the same problem, I can connect to my mariadb using adminer and dbeaver using outside connection. But with npm I can't connect

Always receiving:

› ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'172.18.0.3' (using password: YES)

Already try to change the network to host and does not work.

<!-- gh-comment-id:1121472078 --> @Rodrigolmti commented on GitHub (May 9, 2022): Having the same problem, I can connect to my mariadb using adminer and dbeaver using outside connection. But with npm I can't connect Always receiving: › ✖ error ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'172.18.0.3' (using password: YES) Already try to change the network to host and does not work.
Author
Owner

@graves501 commented on GitHub (Aug 10, 2022):

I had a very similar log in both jc21/nginx-proxy-manager and jc21/mariadb-aria after rebooting my server. In my case the issue was fixed to update the docker images to the latest build:

docker-compose -f nginxproxymanager.yml up --force-recreate --build -d

<!-- gh-comment-id:1210431310 --> @graves501 commented on GitHub (Aug 10, 2022): I had a very similar log in both `jc21/nginx-proxy-manager` and `jc21/mariadb-aria` after rebooting my server. In my case the issue was fixed to update the docker images to the latest build: `docker-compose -f nginxproxymanager.yml up --force-recreate --build -d`
Author
Owner

@github-actions[bot] commented on GitHub (Feb 22, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:1958514084 --> @github-actions[bot] commented on GitHub (Feb 22, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Apr 7, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2781853456 --> @github-actions[bot] commented on GitHub (Apr 7, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1386
No description provided.