New Ghost Install Wont Start

I’m having an issue on a new instance, running in ubuntu 22.04 vm, installed per documentation just minus NGINX as I have that setup outside of this VM.

My error is “unkown database error” ECONNREFUSED ::1:3306

server@Ghost:/var/www/ghost$ ghost start

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


+ sudo systemctl is-active ghost_blog-trever-cloud
+ sudo systemctl reset-failed ghost_blog-trever-cloud
✔ Checking system Node.js version - found v18.20.6
✔ 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_blog-trever-cloud
✔ 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.20.6
+ sudo systemctl start ghost_blog-trever-cloud
+ sudo systemctl stop ghost_blog-trever-cloud
✖ Starting Ghost: blog-trever-cloud
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_blog-trever-cloud -n 50

Debug Information:
    OS: Ubuntu, v22.04.5 LTS
    Node Version: v18.20.6
    Ghost Version: 5.108.1
    Ghost-CLI Version: 1.26.1
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/server/.ghost/logs/ghost-cli-debug-2025-01-30T15_07_24_190Z.log

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

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.

Running ghost doctor, this is my output:

server@Ghost:/var/www/ghost$ ghost doctor

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


✔ Checking system Node.js version - found v18.20.6
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
System checks failed with message: 'Missing package(s): nginx'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
System stack check skipped
ℹ Checking system compatibility [skipped]
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_blog-trever-cloud
+ sudo systemctl reset-failed ghost_blog-trever-cloud
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.20.6
server@Ghost:/var/www/ghost$ ghost start

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


+ sudo systemctl is-active ghost_blog-trever-cloud
✔ Checking system Node.js version - found v18.20.6
✔ 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_blog-trever-cloud
✔ 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.20.6
+ sudo systemctl start ghost_blog-trever-cloud
+ sudo systemctl stop ghost_blog-trever-cloud
✖ Starting Ghost: blog-trever-cloud
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_blog-trever-cloud -n 50

Debug Information:
    OS: Ubuntu, v22.04.5 LTS
    Node Version: v18.20.6
    Ghost Version: 5.108.1
    Ghost-CLI Version: 1.26.1
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/server/.ghost/logs/ghost-cli-debug-2025-01-30T15_20_26_155Z.log

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

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.

And running the suggested ‘journalctl -u ghost_blog-trever-cloud -n 50’ I get:

server@Ghost:/var/www/ghost$ journalctl -u ghost_blog-trever-cloud -n 50
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] INFO Ctrl+C to shut down
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] INFO Ghost server started in 0.264s
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] INFO Bootstrap client was closed.
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] ERROR connect ECONNREFUSED ::1:3306
Jan 30 15:20:25 Ghost node[19113]: 
Jan 30 15:20:25 Ghost node[19113]: connect ECONNREFUSED ::1:3306
Jan 30 15:20:25 Ghost node[19113]: "Unknown database error"
Jan 30 15:20:25 Ghost node[19113]: Error ID:
Jan 30 15:20:25 Ghost node[19113]:     500
Jan 30 15:20:25 Ghost node[19113]: Error Code: 
Jan 30 15:20:25 Ghost node[19113]:     ECONNREFUSED
Jan 30 15:20:25 Ghost node[19113]: ----------------------------------------
Jan 30 15:20:25 Ghost node[19113]: Error: connect ECONNREFUSED ::1:3306
Jan 30 15:20:25 Ghost node[19113]:     at /var/www/ghost/versions/5.108.1/node_modules/knex-migrator/lib/database.js:57:19
Jan 30 15:20:25 Ghost node[19113]:     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Jan 30 15:20:25 Ghost node[19113]: 
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] WARN Ghost is shutting down
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] WARN Ghost has shut down
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] WARN Your site is now offline
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] WARN Ghost was running for a few seconds
Jan 30 15:20:25 Ghost node[19113]: [2025-01-30 15:20:25] INFO Bootstrap client was closed.
Jan 30 15:20:25 Ghost systemd[1]: Stopping Ghost systemd service for blog: blog-trever-cloud...
Jan 30 15:20:26 Ghost node[19085]: /usr/lib/node_modules/ghost-cli/lib/process-manager.js:46
Jan 30 15:20:26 Ghost node[19085]:         throw error;
Jan 30 15:20:26 Ghost node[19085]:         ^
Jan 30 15:20:26 Ghost node[19085]: {
Jan 30 15:20:26 Ghost node[19085]:   message: {
Jan 30 15:20:26 Ghost node[19085]:     statusCode: 500,
Jan 30 15:20:26 Ghost node[19085]:     errorType: 'DatabaseError',
Jan 30 15:20:26 Ghost node[19085]:     level: 'critical',
Jan 30 15:20:26 Ghost node[19085]:     id: 500,
Jan 30 15:20:26 Ghost node[19085]:     help: 'Unknown database error',
Jan 30 15:20:26 Ghost node[19085]:     code: 'ECONNREFUSED',
Jan 30 15:20:26 Ghost node[19085]:     property: null,
Jan 30 15:20:26 Ghost node[19085]:     redirect: null,
Jan 30 15:20:26 Ghost node[19085]:     hideStack: false,
Jan 30 15:20:26 Ghost node[19085]:     message: 'Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306',
Jan 30 15:20:26 Ghost node[19085]:     name: 'DatabaseError',
Jan 30 15:20:26 Ghost node[19085]:     errno: -111,
Jan 30 15:20:26 Ghost node[19085]:     syscall: 'connect',
Jan 30 15:20:26 Ghost node[19085]:     address: '::1',
Jan 30 15:20:26 Ghost node[19085]:     port: 3306,
Jan 30 15:20:26 Ghost node[19085]:     fatal: true
Jan 30 15:20:26 Ghost node[19085]:   }
Jan 30 15:20:26 Ghost node[19085]: }
Jan 30 15:20:26 Ghost node[19085]: Node.js v18.20.6
Jan 30 15:20:26 Ghost systemd[1]: ghost_blog-trever-cloud.service: Main process exited, code=exited, status=1/FAILURE
Jan 30 15:20:26 Ghost systemd[1]: ghost_blog-trever-cloud.service: Failed with result 'exit-code'.
Jan 30 15:20:26 Ghost systemd[1]: Stopped Ghost systemd service for blog: blog-trever-cloud.
Jan 30 15:20:26 Ghost systemd[1]: ghost_blog-trever-cloud.service: Consumed 1.068s CPU time.

Check that mysql is actually running.

Check that it is listening for ipv6 connections (which are the default for ‘localhost’ in your distro). I’m guessing that you’ve got MySQL listening for ipv4 connections (127.0.0.1), but Ghost trying to connect to ‘localhost’ and getting ::1 (the ipv6 localhost). You can hard code the database address as 127.0.0.1 in your config.production.json file, or you can define localhost as being the ipv4 address in /etc/hosts.

mysql is running and active.
my /etc/hosts looks like this, is this right or what do I need to add/change?

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data
#
127.0.1.1 Ghost Ghost
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I’d remove the localhost from ::1. See if that fixes it.