A GhostError occurred "getaddrinfo EAI_AGAIN ghosth ghosth:3306"

So, I was trying to install ghost cms using the official guide to test it out.

Everything checks out until I hit: ghost start, here’s what it looks like:

ankush@localhost:/var/www/ghost$ ghost start
+ sudo systemctl is-active ghost_IP
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_IP
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
+ sudo systemctl start ghost_IP
+ sudo systemctl stop ghost_IP
✖ Starting Ghost: IP-adress-here
A GhostError occurred.

Message: getaddrinfo EAI_AGAIN ghosth ghosth:3306
Help: Unknown database error

I also see a similar thread here but I don’t see a proper solution to it.

I’d appreciate if you could help me know the root cause for this issue. Thanks in advance!

Hey @Ankush_Das,

Could you show your Ghost config so we’re able to get a bit more context? It looks like Ghost is failing to find a hostname of some description.

Could you point me to a resource (or probably let me know the command) to get the config information?

Not sure if this helps, but this is the basic information for the setup:

OS: Ubuntu, v18.04.3 LTS
Node Version: v10.17.0
Ghost Version: 3.1.1
Ghost-CLI Version: 1.13.1

Let me know what else do you need.

Hey @Ankush_Das,

There should be a file called config.production.json in the directory that you installed Ghost. For example /var/www/ghost/config.production.json

1 Like

Thanks for pointing that out. I looked it up and found this:

{
      "url": "http://IP Address",
      "server": {
        "port": 2368,
        "host": "127.0.0.1"
      },
      "database": {
        "client": "mysql",
        "connection": {
          "host": "ghosth",
          "user": "ghostu",
          "password": "passwordhere",
          "database": "ghostdb"
        }
      },
      "mail": {
        "transport": "Direct"
      },
      "logging": {
    "transports": [
          "file",
          "stdout"
        ]
      },
      "process": "systemd",
      "paths": {
        "contentPath": "/var/www/ghost/content"
      },
      "bootstrap-socket": {
        "port": 8000,
        "host": "localhost"
      }
    }

Following up to see if you found something that can help me fix the issue?

This is what it’s failing on. When Ghost is trying to connect to the mysql database that you’ve specified in your config it’s timing out trying to look up the hostname ghosth

1 Like

Okay, thanks for the heads up. I’m not sure how to deal with that because I did setup the database right before installing ghost as per the documentation. Not sure what went wrong here, I’ll have to try it again, I guess.

Where did you install the database? If it was on the same machine as you installed Ghost then you probably want to use localhost in the database host config. Where did the ghosth value come from?

1 Like

I did install the database in the server. Thanks to you, I was able to figure out what I did wrong - however, I did something very wrong on my server (had multiple mysql packages) before I tried to install ghost. So, I shall delete this instance and create a new one so that I can make sure everything is back to default before installing ghost cms.