✖ Starting Ghost
One or more errors occurred.
Message: Error trying to connect to the MySQL database.
Help: You can run `ghost config` to re-enter the correct credentials. Alternatively you can run `ghost setup` again.
Message: Ghost was able to start, but errored during boot with: Access denied for user 'root'@'localhost'
Help: Unknown database error
Suggestion: journalctl -u ghost_sasikaspace-ml-1 -n 50
OS: Ubuntu, v18.04.6 LTS
Node Version: v16.15.1
Ghost Version: 5.2.2
Ghost-CLI Version: 1.21.0
Command: 'ghost install'
Additional log info available in: /home/ubuntu/.ghost/logs/ghost-cli-debug-2022-06-10T17_51_28_864Z.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.
ubuntu@ip-172-31-19-178:/var/www/ghost2$ ghost config
Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
This is the issue I faced. It says that the database server is running.
ubuntu@ip-172-31-19-178:/var/www/ghost2$ sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-06-10 17:38:17 UTC; 16min ago
Main PID: 29387 (mysqld)
Tasks: 28 (limit: 1134)
└─29387 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Jun 10 17:38:16 ip-172-31-19-178 systemd: Starting MySQL Community Server...
Jun 10 17:38:17 ip-172-31-19-178 systemd: Started MySQL Community Server.
I was setting up the ghost through a Youtube tutorial, I didn’t get a prompt to change the password for the root user using this command. In the video, he got a pink color prompt to change the password, He was using Ubuntu 16 Lts server instance, and I was using Ubuntu 22,18 (I checked different versions, and got the same result) sudo apt-get install mysql-server
Then, I changed the password for the root user using this post .
These are all the commands that I used when setting up the AWS EC2 instance from the beginning.
It’s best to start with the official guide. So, read this through first to be sure you understand. Also, note that Ubuntu 22.04 isn’t supported, even though it may work.
To attempt to recover your setup, follow this thread from this post. It will show you how to setup MySQL, and restart the installation process. You’ll need to substitute some parts with your site details.
The documentation mentioned to use root (as a user) and key in the password of root (during ghost setup) - BUT if you are in a hurry to install apt install mysql-server, there is no root password specified - u can try mysql -u root -p (enter) and you will go straight to mysql prompt.
If you put in the root password during the setup it will fail the setup (as ghost user could not be set up and therefore the rest does not fall in place. The solution for me is to create a non-root user and ghost user manually like this:
CREATE USER ‘test’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
GRANT ALL PRIVILEGES ON . TO ‘test’@‘localhost’ WITH GRANT OPTION;
Do the same for ‘ghost’@‘localhost’
During Ghost setup enter test (and not root) and when come to set up ghost user pick n (for no)
Of course, this is meant for POC (proof of concept)