I was trying to install ghost on Docker container using Cyberpanel Docker manager as per the below web guide.
However I’m getting below error log
[90mError: connect ECONNREFUSED 127.0.0.1:3306
at /var/lib/ghost/versions/5.22.11/node_modules/knex-migrator/lib/database.js:57:19
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)e[39m
e[39m
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost is shutting down
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost has shut down
[2022-11-18 07:08:27] e[35mWARNe[39m Your site is now offline
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost was running for a few seconds
Does anyone knows how to fix this and install Ghost CMS correct way?
As you can see knexjs is trying to connect to your MariaDB with no success.
First of all you pull the unofficial image Docker as instructed in the tutorial you tagged
To run Ghost for production you’ll also need to be running with MySQL 8 ( Required in production) https, and a reverse proxy configured with appropriate X-Forwarded-For , X-Forwared-Host , and X-Forwarded-Proto (https ) headers. Configuration - Adapt your publication to suit your needs
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: mysqulrootp@ssworD
database__connection__database: yourdomain_prodction
I’ve added the ENV variables like below and still getting the same error? my Mariadb hostname showing as localhost and i’ve put that into host field. is that correct? Please help.
connected to MariaDB via SSH and set a password for root user. there was no password when i first connect to mysql, so i thought that was an issue, so i set a password using below command.
using this command
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘passwordused’;
flush privileges;
exit;