ECONNREFUSED 127.0.0.1:3306 when using fly.io

Ghost has had a breaking chance with a switch from sqlite3 to MySQL by default

I’m trying to get a totally new build to work but keep getting “ECONNREFUSED 127.0.0.1:3306”

Should anyone have been able to make Ghost work with MySQL in fly.io, I’d appreciate to understand your setup.

The error message indicates that the connection to MySQL is refused. Most likely a permissions issue, but difficult to say since you haven’t described your setup is any detail.

1 Like

Thanks for commenting. For the sake of others :slight_smile:
MySQL is not part of Ghost’s docker image, so you need to install it separately, when doing that you realize the real issue: MySQl8 needs a lot more RAM than fly.io offers and what most hosting platforms offer. Bare minimum one seemingly needs 2GB RAM. PS: PlanetScale was also never an option
Conclusion: Hosting Ghost on fly.io’s (free tier) is no longer an option

1 Like

Ghost recommend a minimum of 1 GB (you may want to amend your post’s reference to MB), but I find 2 GB more realistic unless you are prepared to optimize your host.

2 Likes

if you still wish to run SQLite in Ghost 5,
add to fly.toml

[env]
  database__client = "sqlite3"
  database__connection__filename = "/var/lib/ghost/content/data/ghost.db"