Using the official Ghost install doc I get multiple errors installing on DigitalOcean. Searching suggests the errors are common in Ghost history and one possible cause of the MySQL error is how the root password was being set. Did the DB rebuild repair and manual password set but no joy on a fix.
Any suggestions are welcome.
Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
Help: Unknown database error
Suggestion: journalctl -u ghost_ghost-mydomain.com -n 50
Oct 06 21:06:19 ghost node[9530]: connect ECONNREFUSED ::1:3306
Oct 06 21:06:19 ghost node[9530]: "Unknown database error"
Oct 06 21:06:19 ghost node[9530]: Error ID:
Oct 06 21:06:19 ghost node[9530]: 500
Oct 06 21:06:19 ghost node[9530]: Error Code:
Oct 06 21:06:19 ghost node[9530]: ECONNREFUSED
Oct 06 21:06:19 ghost node[9530]: ----------------------------------------
Oct 06 21:06:19 ghost node[9530]: Error: connect ECONNREFUSED ::1:3306
Oct 06 21:06:19 ghost node[9530]: at /var/www/ghost/versions/5.68.0/node_modules/knex-migrator/lib/database.j>
Oct 06 21:06:19 ghost node[9530]: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Oct 06 21:06:19 ghost node[9530]:
Oct 06 21:06:19 ghost node[9530]: [2023-10-06 21:06:19] WARN Ghost is shutting down
Debug Information:
OS: Ubuntu, v22.04.3 LTS
Node Version: v18.18.0
Ghost Version: 5.68.0
Ghost-CLI Version: 1.25.2
Environment: production
Command: 'ghost install'
â Checking for a MySQL installation
+ sudo systemctl is-active ghost_ghost-mydomain.com
+ sudo systemctl reset-failed ghost_ghost-mydomain.com
mysql Ver 8.0.34-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
Donât use root for the database, and follow these instructions. By default, the root MySQL account doesnât use a native password. This works with Ubuntu 22.04.
sudo apt update && sudo apt upgrade --yes
sudo apt install mysql-server --yes
sudo systemctl start mysql.service
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<ROOT_PASSWORD>';
QUIT;
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE USER '<GHOST_USER>'@'localhost' IDENTIFIED BY '<USER_PASSWORD>';
CREATE DATABASE <GHOST_DATABASE>;
GRANT ALL PRIVILEGES ON <GHOST_DATABASE>.* TO '<GHOST_USER>'@'localhost';
FLUSH PRIVILEGES;
QUIT;
What do you do in this? Yes edit No for root then no for Ghost user and setup credential manually?
Enter your blog URL:
Enter your MySQL hostname: localhost
Enter your MySQL username: root edit <ghost_user>
Enter your MySQL password: Edit as set in `CREATE USER â<GHOST_USER>â@âlocalhostâ IDENTIFIED BY â<USER_PASSWORD>â;
Enter your Ghost database name: <yourfoldername_prod>
Do you wish to set up âghostâ mysql user? Yes
If I start on fresh server and remember to set root mysql password BEFORE starting with the Official Install doc then things go pretty well.
Note to Docs Team: You might want to add the need to set the root password and actually more appropriate mysql instructions such as How to Install MySQL on Ubuntu 22.04
Best I can do yields
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] INFO Ctrl+C to shut down
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] INFO Ghost server started in 1.072s
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] INFO Bootstrap client was closed.
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] ERROR connect ECONNREFUSED ::1:3306
Oct 07 23:13:41 ghost node[1984]:
Oct 07 23:13:41 ghost node[1984]: connect ECONNREFUSED ::1:3306
Oct 07 23:13:41 ghost node[1984]: "Unknown database error"
Oct 07 23:13:41 ghost node[1984]: Error ID:
Oct 07 23:13:41 ghost node[1984]: 500
Oct 07 23:13:41 ghost node[1984]: Error Code:
Oct 07 23:13:41 ghost node[1984]: ECONNREFUSED
Oct 07 23:13:41 ghost node[1984]: ----------------------------------------
Oct 07 23:13:41 ghost node[1984]: Error: connect ECONNREFUSED ::1:3306
Oct 07 23:13:41 ghost node[1984]: at /var/www/ghost/versions/5.68.0/node_modules/knex-migrator/lib/database.js:57:19
Oct 07 23:13:41 ghost node[1984]: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Oct 07 23:13:41 ghost node[1984]:
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] WARN Ghost is shutting down
Oct 07 23:13:41 ghost node[1984]: [2023-10-07 23:13:41] WARN Ghost has shut down
@mjw Have you used your approach on Ghost version 5.68?
Wondering if the culprit is
at /var/www/ghost/versions/5.68.0/node_modules/knex-migrator/lib/database.js:57:19
Itâs unclear what entries you made, but you should substitute the values indicated with the <> with your user ID and password for each Ghost instance.
This is the first step after installing MySQL, and should have been done before. The error message indicates that the credentials you used are incorrect.
However, your server might not have IPV4 set up since the message connect ECONNREFUSED ::1:3306 shows an IPV6 address for localhost, i.e., ::1.