â Starting Ghost
One or more errors occurred.
1) CliError
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.
2) GhostError
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
Debug Information:
OS: Ubuntu, v18.04.6 LTS
Node Version: v16.15.1
Ghost Version: 5.2.2
Ghost-CLI Version: 1.21.0
Environment: production
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.
https://careers.ghost.org/product-engineer-node-js
ubuntu@ip-172-31-19-178:/var/www/ghost2$
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)
CGroup: /system.slice/mysql.service
ââ29387 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Jun 10 17:38:16 ip-172-31-19-178 systemd[1]: Starting MySQL Community Server...
Jun 10 17:38:17 ip-172-31-19-178 systemd[1]: Started MySQL Community Server.
The error messages are quite explicit. Are your credentials correct, i.e., did you enter them correctly when setting up Ghost, or does the database user have the correct permissions for the database?
Have you checked? Did ghost setup complete without error? Did you create a MySQL database and user for Ghost?
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)