Ghost DigitalOcean fresh installation skips setting up `ghost` mysql user
See original GitHub issueIssue 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
- Get a domain name from a domain registarar
- Make a new droplet from digitalocean
- Install ghost on that new domain
- Make proper DNS configurations
- 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:
- Created 3 years ago
- Comments:15 (5 by maintainers)
Top GitHub Comments
Hmm, ok. Iโll take a deeper look and see if I canโt figure out whatโs going on.
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 ๐