Fix Ghost was able to start, but errored during boot with: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'

I face some errors during installation of Ghost
check out put

ghost start
+ sudo systemctl is-active ghost_learn-careersnote-com
+ sudo systemctl reset-failed ghost_learn-careersnote-com
✔ Checking system Node.js version - found v14.19.0
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_learn-careersnote-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking systemd unit file
✔ Checking systemd node version - found v14.19.0
+ sudo systemctl start ghost_learn-careersnote-com
+ sudo systemctl stop ghost_learn-careersnote-com
✖ Starting Ghost: learn-careersnote-com
A GhostError occurred.

Message: Ghost was able to start, but errored during boot with: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_learn-careersnote-com -n 50

Debug Information:
    OS: Ubuntu, v20.04 LTS
    Node Version: v14.19.0
    Ghost Version: 4.38.0
    Ghost-CLI Version: 1.18.1
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/phenix/.ghost/logs/ghost-cli-debug-2022-03-07T18_02_24_558Z.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.

Any solution to fix my start process

The message is saying that Ghost couldn’t connect with the database, so check your credentials. It’s best practice to create a non-root user for your database, e.g.,

create user 'ghost_learn-careersnote-com'@'localhost' identified by 'FhxevcLvigY8a7Moc3Qgq96n';
grant all on ghost_learn-careersnote-com.* to 'username'@'localhost' identified by 'password' with grant option;

Use ghost setup --help for a list of commands to update the config.

Hey I’m having this issua as well since the last two-three versions of ghost. By pure chance I found a way to manage it that works for me:
I’m using digitaloceans droplet, and I simply turn it off by typing sudo poweroff. Then I log into digitalociean and restart the droplet and voila problem solved it works.

Hopefully it will work for someone else as well.

nothing happen, errors message even I change some details on .json file(Database : name and Passowrd with root username).
rant all on ghost_learn-careersnote-com.* to 'username'@'localhost' identified by 'password' with grant option;
not working and get error syntaxe message.

As I said, it’s not good practice to use root to login, so create a database user just for ghost and give the new user full access to that db.

And amend the credentials using ghost setup command as previously stated.