In this tutorial you will learn how to fix the issue that prevents Ghost instance from starting correctly, this issue happens because Ghost is not able to connect to the database.
To fix this issue you need to create a database and the user for the database then restart the installation setup.
Step 1 - Set a password for MySQL
Type the command below and press enter, then simply enter the password and press enter again.
Step 2 - Update user
Now you need to update the mysql user by running the command below, make sure to replace 'password' with your password and press enter.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Note: Replace password but do not remove the qoute marks.
Step 3 - Exit from MySQL
Once you have created the database and given access to the user by using the alter command on mysql you are good to go and exit from mysql
Step 4 - Restart Ghost Installation
To restart Ghost installation you need to use the command below, type this command on the directory where you were installing ghost.
Directory should look like this
If you get an error that doesn't let you restart the installation, try to uninstall ghost by using the command below then try again.
If both commands, the installation and uninstall command fail, try to delete everything that is inside the folder 'site-name' on /var/www/site-name.
Make sure you are located on the right directory where ghost was installed before you run the rm command because it will delete everything the folder itself and the data inside.
There will be two folders inside the directory where Ghost was installed, Content and System, delete both folders by using the rm command as shown on the example below
sudo rm content sudo rm system
Next, retry to install Ghost again.
By now you should know how to fix this issue on Ghost.