DB connection refused in ghost local

I installed ghost local v 5.69.3 in a vagrant VM running Ubuntu 20.04. Install takes forever. ghost ls shows the localhost:2368 as running but it won’t restart. ghost run shows this error:
[2023-10-18 22:20:16] INFO Your site is now available on http://localhost:2368/
[2023-10-18 22:20:16] INFO Ctrl+C to shut down
[2023-10-18 22:20:16] INFO Ghost server started in 1.028s
[2023-10-18 22:20:17] ERROR connect ECONNREFUSED 127.0.0.1:3306

I’m using latest version of ghost-cli, node 18.18.2, npm 10.2.1. I’ve tried uninstalling and reinstalling. npm ls shows several deprecated modules.

How do I get the DB connection to work with sqlite3? I thought ghost local is ready to use.

That error means MySQL isn’t running or isn’t accepting connections. Is it running?

Hang on - you meant to install local? I think somehow you didn’t. Did you run “ghost install local” to set it up?

1 Like

It’s a local installation. I ran ghost install local. Then it hangs at “Starting Ghost.” The DB for local is sqlite3 which installs with ghost install local. But I can’t troubleshoot why the DB connection fails. Any suggestions?

I’m running the vagrant VM with an nfs mount over udp to my host computer. This seems to be the issue. I disconnected the mount and ran ghost install local. This runs fine on the VM itself but with the nfs mount the install takes forever and then I get the DB connection issue. Are there others who run ghost locally in a VM with an nfs mount? I do this so that I can develop locally outside the VM. There are a lot of node modules that have to be downloaded, lot of traffic to have the ghost files live on my host computer outside of the VM.

This is my guess that the problem comes from Node 18. Somehow, Ghost-CLI is not compatible with Node 18. If you use Node 16, it will work. I had troubles with it last week when i upgraded Node to version 18 and 20.

Check your config.production.json.

You expect to connect to SQLite and are failing to connect to MySQL. Sounds like a config problem.

I have a config.development.json file. The DB is sqlite3. I managed to get it to work but only after installing and re-installing 3 times. For whatever reason the downloads of versons/5.69.3/node_modules were failing. Several of these node modules are deprecated, which is a concern. Someone needs to update 5.69.3/package.json