Question

Ghost 1click app: Access denied for user 'ghost'@'localhost'

  • Posted June 30, 2020
  • Ghost

After creating the droplet and adding the A record, I’m getting this db error: Message: ER_ACCESS_DENIED_ERROR: Access denied for user 'ghost'@'localhost' (using password: YES)

Any help is appreciated.

Full log follows:

Press enter when you're ready to get started!


+ sudo chown -R ghost-mgr:ghost-mgr /home/ghost-mgr/.config
✔ Checking system Node.js version
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v3.21.1
✔ Finishing install process
? Enter your blog URL: https://mywebsite.com
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
ℹ Setting up "ghost" mysql user [skipped]
✔ Creating nginx config file at /var/www/ghost/system/files/mywebsite.com.conf
+ sudo ln -sf /var/www/ghost/system/files/mywebsite.com.conf /etc/nginx/sites-available/mywebsite.com.conf
+ sudo ln -sf /etc/nginx/sites-available/mywebsite.com.conf /etc/nginx/sites-enabled/mywebsite.com.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Enter your email (For SSL Certificate) myself@mywebsite.com
+ sudo mkdir -p /etc/letsencrypt
+ sudo ./acme.sh --install --home /etc/letsencrypt
+ sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --domain mywebsite.com --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail myself@mywebsite.com
+ sudo openssl dhparam -out /etc/nginx/snippets/dhparam.pem 2048
+ sudo mv /tmp/ssl-params.conf /etc/nginx/snippets/ssl-params.conf
✔ Creating ssl config file at /var/www/ghost/system/files/mywebsite.com-ssl.conf
+ sudo ln -sf /var/www/ghost/system/files/mywebsite.com-ssl.conf /etc/nginx/sites-available/mywebsite.com-ssl.conf
+ sudo ln -sf /etc/nginx/sites-available/mywebsite.com-ssl.conf /etc/nginx/sites-enabled/mywebsite.com-ssl.conf
+ sudo nginx -s reload
✔ Setting up SSL
✔ Creating systemd service file at /var/www/ghost/system/files/ghost_mywebsite-com.service
+ sudo ln -sf /var/www/ghost/system/files/ghost_mywebsite-com.service /lib/systemd/system/ghost_mywebsite-com.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_mywebsite-com
+ sudo systemctl start ghost_mywebsite-com
+ sudo systemctl stop ghost_mywebsite-com
✖ Starting Ghost
One or more errors occurred.

1) GhostError

Message: ER_ACCESS_DENIED_ERROR: Access denied for user 'ghost'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_mywebsite-com -n 50
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, @amatosg

It seems like the creation of the ghost MySQL user was skipped and presumably a database was not created:

Setting up "ghost" mysql user [skipped]

What you can do is to manually create the DB user and grant it all privileges on the database as well.

  • Login to MySQL sudo mysql
  • Create a new database user - ghost CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'password'
  • Create a new database ghostdb CREATE DATABASE ghostdb
  • Grant access for the new user GRANT ALL PRIVILEGES ON ghostdb. * TO 'ghost'@'localhost'
  • Exit mysql quit

You can then trigger the install script again by executing it or by simply logging off and then on the next login the install script will be automatically executed.

Hope that helps!

Regards, Alex

Honestly I can’t help but feel this is intentional so that you’re pushed to go for the self-hosted solution. I wish I wasn’t so cynical but then I would be wrong most of the time

Deleting and creating a new droplet allowed me to get it to work (mysql user still is being skipped though)

for some reason the user was already created. I ran the other steps, but the install script won’t run after login. Where can I find it to run it manually? Thanks

Thank you Alex, but I find it odd that an automated process is skipping such step. I will try to apply your steps.

Thanks again.