Issue with Ghost

Hi all,
Been a while since I’ve used Ghost, giving it a try again on a VPS with 30G of disk space and 2GB of RAM, it seems to install correctly however when I have ghost install try to start it it replies with:

One or more errors occurred.

  1. GhostError

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

Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v18.16.1
Ghost Version: 5.54.2
Ghost-CLI Version: 1.24.2
Environment: production
Command: ‘ghost install’

Additional log info available in: /home/strange/.ghost/logs/ghost-cli-debug-2023-07-17T02_00_31_213Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to Ghost-CLI - A fully loaded tool for installation and configuration for troubleshooting.
strange@blog:/var/www/enigmatic.zone$ cat /home/strange/.ghost/logs/ghost-cli-debug-2023-07-17T02_00_31_213Z.log
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v18.16.1
Ghost Version: 5.54.2
Ghost-CLI Version: 1.24.2
Environment: production
Command: ‘ghost install’
Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
Help: Unknown database error
Suggestion: journalctl -u ghost_enigmatic-zone -n 50
Stack: Error: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
at Server. (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:73:28)
at Object.onceWrapper (node:events:627:28)
at Server.emit (node:events:513:28)
at emitCloseNT (node:net:2135:8)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

When I try to run ghost doctor I get:

strange@blog:/var/www/enigmatic.zone$ ghost doctor

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

:heavy_check_mark: Checking system Node.js version - found v18.16.1
:heavy_check_mark: Checking logged in user
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Checking system compatibility
:heavy_check_mark: Checking for a MySQL installation

  • sudo systemctl is-active ghost_enigmatic-zone
  • sudo systemctl reset-failed ghost_enigmatic-zone
    :heavy_check_mark: Validating config
    :heavy_check_mark: Checking folder permissions
    :heavy_check_mark: Checking file permissions
    :heavy_check_mark: Checking content folder ownership
    :heavy_check_mark: Checking memory availability
    :heavy_check_mark: Checking binary dependencies
    :heavy_check_mark: Checking free space
    :heavy_check_mark: Checking systemd unit file
    :heavy_check_mark: Checking systemd node version - found v18.16.1

Other information that may be helpful:

strange@blog:/var/www/enigmatic.zone$ journalctl -u ghost_enigmatic-zone -n 50
Hint: You are currently not seeing messages from other users and the system.
Users in groups ‘adm’, ‘systemd-journal’ can see all messages.
Pass -q to turn off this notice.
– No entries –

Any suggestions on how to fix it? I’m using Ubuntu 22.04, with Nodejs 18.04.

Please post output using the correct credentials, e.g., use sudo.

Ok, sorry about that. Here is the actual results:

Jul 17 02:00:30 blog node[18525]: connect ECONNREFUSED ::1:3306
Jul 17 02:00:30 blog node[18525]: “Unknown database error”
Jul 17 02:00:30 blog node[18525]: Error ID:
Jul 17 02:00:30 blog node[18525]: 500
Jul 17 02:00:30 blog node[18525]: Error Code:
Jul 17 02:00:30 blog node[18525]: ECONNREFUSED
Jul 17 02:00:30 blog node[18525]: ----------------------------------------
Jul 17 02:00:30 blog node[18525]: Error: connect ECONNREFUSED ::1:3306
Jul 17 02:00:30 blog node[18525]: at /var/www/enigmatic.zone/versions/5.54.2/node_modules/knex-migrator/lib/database.js:57:19
Jul 17 02:00:30 blog node[18525]: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
Jul 17 02:00:30 blog node[18525]:
Jul 17 02:00:30 blog node[18525]: [2023-07-17 02:00:30] WARN Ghost is shutting down
Jul 17 02:00:30 blog node[18525]: [2023-07-17 02:00:30] WARN Ghost has shut down
Jul 17 02:00:30 blog node[18525]: [2023-07-17 02:00:30] WARN Your site is now offline
Jul 17 02:00:30 blog node[18525]: [2023-07-17 02:00:30] WARN Ghost was running for a few seconds
Jul 17 02:00:30 blog node[18525]: [2023-07-17 02:00:30] INFO Bootstrap client was closed.
Jul 17 02:00:30 blog systemd[1]: Stopping Ghost systemd service for blog: enigmatic-zone…
Jul 17 02:00:31 blog node[18496]: /usr/lib/node_modules/ghost-cli/lib/process-manager.js:46
Jul 17 02:00:31 blog node[18496]: throw error;
Jul 17 02:00:31 blog node[18496]: ^
Jul 17 02:00:31 blog node[18496]: {
Jul 17 02:00:31 blog node[18496]: message: {
Jul 17 02:00:31 blog node[18496]: statusCode: 500,
Jul 17 02:00:31 blog node[18496]: errorType: ‘DatabaseError’,
Jul 17 02:00:31 blog node[18496]: level: ‘critical’,
Jul 17 02:00:31 blog node[18496]: message: ‘Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306’,
Jul 17 02:00:31 blog node[18496]: id: 500,
Jul 17 02:00:31 blog node[18496]: help: ‘Unknown database error’,
Jul 17 02:00:31 blog node[18496]: name: ‘DatabaseError’,
Jul 17 02:00:31 blog node[18496]: code: ‘ECONNREFUSED’,
Jul 17 02:00:31 blog node[18496]: property: null,
Jul 17 02:00:31 blog node[18496]: redirect: null,
Jul 17 02:00:31 blog node[18496]: hideStack: false,
Jul 17 02:00:31 blog node[18496]: errno: -111,
Jul 17 02:00:31 blog node[18496]: syscall: ‘connect’,
Jul 17 02:00:31 blog node[18496]: address: ‘::1’,
Jul 17 02:00:31 blog node[18496]: port: 3306,
Jul 17 02:00:31 blog node[18496]: fatal: true
Jul 17 02:00:31 blog node[18496]: }
Jul 17 02:00:31 blog node[18496]: }
Jul 17 02:00:31 blog node[18496]: Node.js v18.16.1
Jul 17 02:00:31 blog systemd[1]: ghost_enigmatic-zone.service: Main process exited, code=exited, status=1/FAILURE
Jul 17 02:00:31 blog systemd[1]: ghost_enigmatic-zone.service: Failed with result ‘exit-code’.

I have also verified the database information is correct.

That shows Ghost attempting to use the ::1 IPv6 address, is your MySQL server listening on that? How did you specify the database server address in your config?

1 Like

My database configuration is:

"database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "strange",
      "password": "password",
      "database": "strange_prod"
    }

The /etc/hosts file says that localhost is 127.0.0.1

Can you set the host to "127.0.0.1", recent versions of node default to ipv6 but that should force the standard ipv4 address which is likely what your mysql server is listening on.

1 Like

Thanks Kevin, that fixed it. Would be nice if the install docs could be updated!

Just wanted to chime in here and add that this was the fix for me after an hour of debugging! Thanks very much :slight_smile:

1 Like