question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Ghost DigitalOcean fresh installation skips setting up `ghost` mysql user

See original GitHub issue

Issue Summary

Hello!

I was just setting up a ghost droplet on digitalocean, when I ran into the issue of ghost failing to start because it skipped a mysql step, logs are below.

The specific line is,

โ„น Setting up "ghost" mysql user [skipped]

The complete logs are,

You are required to change your password immediately (root enforced)
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-112-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Aug  3 06:43:19 UTC 2020

  System load:  0.0               Processes:           89
  Usage of /:   9.3% of 24.06GB   Users logged in:     0
  Memory usage: 29%               IP address for eth0: 139.59.76.56
  Swap usage:   0%

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

28 packages can be updated.
0 updates are security updates.

Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


********************************************************************************

Welcome to DigitalOcean's One-Click Ghost Droplet.
To keep this Droplet secure, the UFW firewall is enabled. 
All ports are BLOCKED except 22 (SSH), 80 (HTTP), and 443 (HTTPS).

For help and more information, visit http://do.co/ghost1804

********************************************************************************
To delete this message of the day: rm -rf /etc/update-motd.d/99-one-click
Last login: Mon Aug  3 06:41:36 2020 from xxx.xxx.xxx
Changing password for root.
(current) UNIX password: 
Enter new UNIX password: 
Retype new UNIX password: 
You must choose a longer password
Enter new UNIX password: 
Retype new UNIX password: 

-------------------------------------------------------------------------------

Configuring DigitalOcean 1-Click Ghost installation.

Please wait a minute while your 1-Click is configured. 

Once complete, you are encouraged to run mysql_secure_installation to ready
your server for production. Passwords have been saved to:

    root/.digitalocean_password

-------------------------------------------------------------------------------


Ensuring Ghost-CLI is up-to-date...
+ sudo npm i -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ ghost-cli@1.14.1
removed 1 package and updated 4 packages in 59.669s


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                                                โ”‚
   โ”‚      New patch version of npm available! 6.14.4 โ†’ 6.14.7       โ”‚
   โ”‚   Changelog: https://github.com/npm/cli/releases/tag/v6.14.7   โ”‚
   โ”‚               Run npm install -g npm to update!                โ”‚
   โ”‚                                                                โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


Ghost will prompt you for two details:

1. Your domain
 - Add an A Record -> xxx.xxx.xxx & ensure the DNS has fully propagated
 - Or alternatively enter http://xxx.xxx.xxx
2. Your email address (only used for SSL)

Press enter when you're ready to get started!

dev-hearted.software
+ 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.27.0
โœ” Finishing install process
? Enter your blog URL: https://dev-hearted.software
โœ” 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] <------------------------------- *Here is the error*
โœ” Creating nginx config file at /var/www/ghost/system/files/dev-hearted.software.conf
+ sudo ln -sf /var/www/ghost/system/files/dev-hearted.software.conf /etc/nginx/sites-available/dev-hearted.software.conf
+ sudo ln -sf /etc/nginx/sites-available/dev-hearted.software.conf /etc/nginx/sites-enabled/dev-hearted.software.conf
+ sudo nginx -s reload
โœ” Setting up Nginx
? Enter your email (For SSL Certificate) johndoe@github.com
+ sudo mkdir -p /etc/letsencrypt
+ sudo ./acme.sh --install --home /etc/letsencrypt
+ sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --domain dev-hearted.software --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail saifulislam84210@gmail.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/dev-hearted.software-ssl.conf
+ sudo ln -sf /var/www/ghost/system/files/dev-hearted.software-ssl.conf /etc/nginx/sites-available/dev-hearted.software-ssl.conf
+ sudo ln -sf /etc/nginx/sites-available/dev-hearted.software-ssl.conf /etc/nginx/sites-enabled/dev-hearted.software-ssl.conf
+ sudo nginx -s reload
โœ” Setting up SSL
โœ” Creating systemd service file at /var/www/ghost/system/files/ghost_dev-hearted-software.service
+ sudo ln -sf /var/www/ghost/system/files/ghost_dev-hearted-software.service /lib/systemd/system/ghost_dev-hearted-software.service
+ sudo systemctl daemon-reload
โœ” Setting up Systemd
+ sudo systemctl is-active ghost_dev-hearted-software
+ sudo systemctl start ghost_dev-hearted-software
+ sudo systemctl stop ghost_dev-hearted-software
โœ– 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_dev-hearted-software -n 50

Debug Information:
    OS: Ubuntu, v18.04.4 LTS
    Node Version: v12.18.0
    Ghost Version: 3.27.0
    Ghost-CLI Version: 1.14.1
    Environment: production
    Command: 'ghost install --auto --db=mysql --dbhost=localhost --dbname=ghost_production --dbuser=ghost --dbpass=some_pass --dir=/var/www/ghost --start'

Additional log info available in: /home/ghost-mgr/.ghost/logs/ghost-cli-debug-2020-08-03T06_58_08_378Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.

------------------------------------------------------------------------------

For any further commands, please switch to the ghost-mgr user to manage Ghost.

    sudo -i -u ghost-mgr

------------------------------------------------------------------------------

root@ghost-ubuntu-s-1vcpu-1gb-blr1-01:~# ghost doctor
You can't run commands as the 'root' user.
Switch to your regular user, or create a new user with regular account privileges and use this user to run 'ghost doctor'.
For more information, see https://ghost.org/docs/install/ubuntu/#create-a-new-user-.

The logs from journalctl are these,

Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Handshake.ErrorPacket (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protoc
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Protocol._parsePacket (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protoc
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Parser._parsePacket (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protocol
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Parser.write (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protocol/Parser
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Protocol.write (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protocol/Prot
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Socket.<anonymous> (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/Connectio
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Socket.<anonymous> (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/Connectio
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Socket.emit (events.js:315:20)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at addChunk (_stream_readable.js:295:12)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at readableAddChunk (_stream_readable.js:271:9)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Socket.Readable.push (_stream_readable.js:212:10)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     --------------------
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Protocol._enqueue (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protocol/P
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Protocol.handshake (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/protocol/
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Connection.connect (/var/www/ghost/versions/3.27.0/node_modules/mysql/lib/Connectio
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at /var/www/ghost/versions/3.27.0/node_modules/knex-migrator/node_modules/knex/lib/dia
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Promise._execute (/var/www/ghost/versions/3.27.0/node_modules/bluebird/js/release/d
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Promise._resolveFromExecutor (/var/www/ghost/versions/3.27.0/node_modules/bluebird/
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at new Promise (/var/www/ghost/versions/3.27.0/node_modules/bluebird/js/release/promis
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at Client_MySQL.acquireRawConnection (/var/www/ghost/versions/3.27.0/node_modules/knex
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at create (/var/www/ghost/versions/3.27.0/node_modules/knex-migrator/node_modules/knex
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]: 
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]: [2020-08-03 07:32:00] INFO Bootstrap client was closed.
Aug 03 07:32:00 ghost-ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Stopping Ghost systemd service for blog: dev-hearted-software...
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]: /usr/lib/node_modules/ghost-cli/lib/process-manager.js:46
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:         throw error;
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:         ^
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]: {
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:   message: {
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     statusCode: 500,
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     errorType: 'DatabaseError',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     level: 'normal',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     message: "ER_ACCESS_DENIED_ERROR: Access denied for user 'ghost'@'localhost' (using pa
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     id: 500,
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     help: 'Unknown database error',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     name: 'DatabaseError',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     code: 'ER_ACCESS_DENIED_ERROR',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     property: null,
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     redirect: null,
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     errno: 1045,
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     sqlMessage: "Access denied for user 'ghost'@'localhost' (using password: YES)",
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     sqlState: '28000',
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:     fatal: true
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]:   }
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 node[4568]: }
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: ghost_dev-hearted-software.service: Main process exited, code=exited, status=1/FAILURE
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: ghost_dev-hearted-software.service: Failed with result 'exit-code'.
Aug 03 07:32:01 ghost-ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Stopped Ghost systemd service for blog: dev-hearted-software.

Googling, I found a forum on digitalocean with the same problem, here. What Iโ€™m not sure about is why the mysql part is even skipped.

To Reproduce

  1. Get a domain name from a domain registarar
  2. Make a new droplet from digitalocean
  3. Install ghost on that new domain
  4. Make proper DNS configurations
  5. Login to your droplet via ssh and watch for everything to be setup.

Considered a bug because the process should be automatic, and ghost doesnโ€™t provide the reason why it skipped the mysql part, which should have been automated.

The fix

For some reason, the password given to the mysql instance isnโ€™t the correct password. In my case, it is trying YES as the password, while the actual user creation has succeeded. I just went into mysql using sudo mysql, and then, I did,

ALTER USER 'ghost'@'localhost' IDENTIFIED BY 'YES';

And then it starts working normally. After making the changes, the output of ghost doctor is,

โœ” Checking system Node.js version
โœ” Checking logged in user
โœ” Ensuring user is not logged in as ghost user
โœ” Checking if logged in user is directory owner
โœ” Checking current folder permissions
โœ” Checking operating system compatibility
โœ” Checking for a MySQL installation
+ sudo systemctl is-active ghost_dev-hearted-software
+ sudo systemctl reset-failed ghost_dev-hearted-software
โœ” Validating config
โœ” Checking folder permissions
โœ” Checking file permissions
โœ” Checking content folder ownership
โœ” Checking memory availability
โœ” Checking binary dependencies

Which should mean everything is A-okay.

Technical details:

  • OS: Ubuntu, v18.04.4 LTS
  • Node Version: v12.18.0
  • Ghost Version: 3.27.0
  • Ghost-CLI Version: 1.14.1
  • Environment: production
  • Command: โ€˜ghost install --auto --db=mysql --dbhost=localhost --dbname=ghost_production --dbuser=ghost --dbpass=some_pass --dir=/var/www/ghost --startโ€™

This issue was first posted in the TryGhost/Ghost repo, but now, after adding in the fix, as an edit, I realize this is an issue of the ghost-cli repository, and should belong there. Let me try if I can shift / transfer it over there.

I tried going through the ghost-cli repository, but I couldnโ€™t find the exact code for where to make the changes.

Thatโ€™s all. Thank you!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
acburdinecommented, Mar 19, 2021

Hmm, ok. Iโ€™ll take a deeper look and see if I canโ€™t figure out whatโ€™s going on.

2reactions
balinterdicommented, Oct 26, 2020

To anyone who comes here in desperation. The first time I couldnโ€™t make it work no matter what.

The 2nd time I was lucky, I guess, and it worked like a charm, so trying from scratch might be the best use of your time ๐Ÿ˜†

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ghost DigitalOcean fresh installation skips setting up ... - GitHub
Hello! I was just setting up a ghost droplet on digitalocean, when I ran into the issue of ghost failing to start because...
Read more >
How to set up ghost - DigitalOcean
Solution after domain direction working was to DESTROY the droplet using REBUILD option, you can search for GHOST and find the original dropletย ......
Read more >
Ghost is not installing on digital ocean - Developer help
Hi, I have tried to install ghost using droplet on Digital Ocean. I got an error. But I am not getting the solution....
Read more >
Troubleshooting DigitalOcean Ghost One-Click Install Issues
Roughly, it's a VM (or maybe a container) with Ubuntu 16.04 on it. They will install MySQL database and default users. You'll get...
Read more >
How to Install Ghost-CLI on DigitalOcean
skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user accountย ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found