Ghost installation in Digital ocean keep failing with this error

Hi,

I followed instructions in this blog. I provided the IP address of the instance to see if I am able to get the instance up and running first but I keep running into this error.

Has anyone else faced the same issue?

your MySQL is probably listening to the ipv6 version of localhost. Here’s discussion and a fix:

1 Like

Hi, thank you. That removed the Connection refused error. But I am having a hard time figuring out how t restart Ghost.

I did the following.

  1. Set up the domain since it was undefined
    ghost config url http://<MY_SERVER_IP>
  2. ghost restart

which throws this error

ghost restart

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


Ghost instance is not running! Starting...
✖ Starting Ghost
A GhostError occurred.

Message: Ghost was able to start, but errored during boot with: Access denied for user 'root'@'localhost' (using password: NO)
Help: Unknown database error

Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.17.1
    Ghost Version: 5.82.1
    Ghost-CLI Version: 1.26.0
    Environment: production
    Command: 'ghost restart'

Additional log info available in: /home/ghost-mgr/.ghost/logs/ghost-cli-debug-2024-04-12T05_39_42_254Z.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.

Ghost recommends I run the Ghost commands as ghost-mgr.
So I switched to that user.
Now it complains of an unknown database.
Should I reinstall Ghost again?

Ghost is installed as standard systemd service:

sudo systemctl restart 'ghost*'

It looks like you’re using root for the Ghost database use, which isn’t ideal. Typically, this MySQL account uses socket rather than password authentication. Therefore, run this code.

sudo mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<YOUR-PASSWORD';
QUIT;
1 Like

Running

root@<server>:~# sudo mysql

throws this error

sudo mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Try this.

sudo mysql -u root

Sorry that doesn’t work either

sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@<server>:~# sudo mysql -u root -p

If you don’t know password for root, install mysql service one more time with full config.

If You don’t know how read my tutorial about using CloudPanel and docker.

  1. #2 Installing CloudPanel on Debian 11
  2. #3 Adding a reverse proxy
  3. #1 GhostCMS - Installation Docker

In those steps You’ll have full working ghost instance.

Then use sudo mysql -u root -p.