Latest Ghost Update Throws "Unknown database error"

To whom it may concern,

I have recently tried to update my Ghost installation to v5.74.0, but ended up with an Unknown database error, which has been occurring since v5.72.0 and I did not have the time to take a deep dive into the issue.

I have just restarted a fresh installation of the server and the error still persists. Hope someone will be able to assist on the issue.


Attempt 1: Fresh Installation With Latest

  • Error Thrown: Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
    Help: Unknown database error
✔ Checking system Node.js version - found v18.18.2
✔ 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_therobexperiment-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.18.2
+ sudo systemctl start ghost_therobexperiment-com
+ sudo systemctl stop ghost_therobexperiment-com
✖ Starting Ghost: therobexperiment-com
A GhostError occurred.

Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
Help: Unknown database error
Suggestion: journalctl -u ghost_therobexperiment-com -n 50

Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost Version: 5.74.0
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost start'


Attempt 2: Changed “localhost” to "127.0.0.1

✔ Checking system Node.js version - found v18.18.2
✔ 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_mywebsite-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.18.2
+ sudo systemctl start ghost_mywebsite-com
+ sudo systemctl stop ghost_mywebsite-com
✖ Starting Ghost: mywebsite-com
A GhostError occurred.

Message: Ghost was able to start, but errored during boot with: Access denied for user 'ghost_user'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_mywebsite-com -n 50

Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost Version: 5.74.0
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost start'


Currently I have no other solution to get out of the above. Hope someone can assist me on a potential solution for the latest installation update.

Thank you.

Seems like you have a mysql config/permissions issue due to the change from localhost to 127.0.0.1. A quick google of your issue showed these

Hi @Kevin,

Is there potentially any direct solution that I may implement as I am definitely not an expert in the Ghost config setup and my recent attempts is just trying out different solutions I have seen from the forum.

Should I then revert my settings back to localhost? But if so, are there any alternative solutions to resolving the default issues with the database error?

I’m also a bit curious as to why this may be happening as without the recent upgrades to Node v18, every upgrade seems to work fine.

Hope you may help give some better context of the situation and hopefully any potential direct solution which I can implement.

Thank you.

It’s more mysql config/mysql user privileges than Ghost config. Do you have a server admin who can handle it for you?

Should I then revert my settings back to localhost ? But if so, are there any alternative solutions to resolving the default issues with the database error?

You can but you’d be back at the original error, to fix that you’d need to adjust your mysql config so it listens on the ipv6 interface. An alternative could be setting a global export NODE_OPTIONS=--dns-result-order=ipv4first for the user that your Ghost instance runs as.

I’m also a bit curious as to why this may be happening as without the recent upgrades to Node v18 , every upgrade seems to work fine.

Node 18 is a major release so can contain breaking changes. In this case it changed its behaviour to favour the DNS result order that the resolver provides rather than always forcing ipv4 to be first, that’s why it now resolves localhost to the ipv6 ::1 instead of the ipv4 127.0.0.1

Hi @Kevin,

Thanks for sharing the context around the ipv4 vs ipv6 issues.

Given such, the conversion from localhost to 127.0.0.1 sounds inevitable and a simpler solution to resolve the `first issue.

However, my main worry is definitely dabbling too much into the mysql config/mysql user privileges, as previously I had to do a hard reset in my last fresh install about 1 year ago mainly due to the mysql config/mysql user privileges, which was advised here: New Ghost v5.41.0 Unable To Connect To MySQL Database - #7 by sgrobert


Are there any direct mysql config example steps that you can help provide that I may execute as well, I do worry about resetting the wrong config, and I have to do everything all over again, as I am quite unsure about the mysql config/mysql user privileges that you are referring to as the current issue.

Do I need to provide any other details to assist you with this?

Hi @sgrobert I assume you are running Ghost on a VPS? Have you considered running Ghost and MySQL as docker containers? It solves a lot of frustrating stuff, the kind that you are experiencing.

I wrote a guide for Hetzner Cloud on arm64 platform, but it should be fine on any VPS.

I’d be happy to walk you through it, DM.

Hi @mheland ,

Thank you for the suggestions.

I was exposed to that option previously but I have some custom config for media storage, so this docker path might be more extensive work, especially if I do need to keep the image manually updated every time there is a release.

Though I totally get the benefits of the docker setup as well.

So I sincerely hope to utilize the traditional method, but it is mainly the config that I need to get past, and sincerely hope to get assistance specifically for that.

Thank you for the suggestion though.

Hi @Kevin,

I have just found a solution.

Basically, I re-installed a brand new server installation following strictly to the instructions in How to install & setup Ghost on Ubuntu 20.04 or 22.04 (The official Ghost-Ubuntu Installation Guide).

All in all, I guess my issue was the manual change from localhost to 127.0.0.1 did not work and a fresh installation clears up the issue altogether noting that the usual localhost placeholders will now be switched over to 127.0.0.1 to resolve the issue while using node 18 and above.

In addition, do ensure that the server instance being used is running on ipv6 as well.

Hope this helps someone else facing the same issue! Cheers! ;)


OS: Ubuntu, v22.04.3 LTS
Node Version: v18.18.2
Ghost Version: 5.74.1
Ghost-CLI Version: 1.25.3
Environment: production

1 Like