Strictly following the Ubuntu install guide on Ubuntu 22.04 fails, because the root
MySQL user gets created with auth_socket
auth, not a password
#1759
Labels
Summary
The docs at https://ghost.org/docs/install/ubuntu/:
sudo apt-get install mysql-server
, thenroot
MySQL user's password, thenghost install
as some newly-created Unix user who hassudo
privilege but is not rootAssuming you follow those instructions to the letter and don't do anything extra, this is guaranteed to fail (at least on an Ubuntu 22.04 AWS EC2 instance; I have not tried in other environments).
This is because the
sudo apt-get install mysql-server
installs MySQL with a root user whose "plugin" (slightly odd MySQL terminology that for these purposes we can read as "authentication method") isauth_socket
. This authentication method uses a Unix socket and simply checks that the Unix user trying to authenticate has the same name as the MySQL user they're trying to authenticate as; no password is used.Thus, if you enter
root
as the MySQL username when prompted byghost install
, then no matter what password you enter, you will hit an error like this:I suggest the ideal fix here is to change
Ghost-CLI
so that if the MySQL username specified isroot
and no password is given, it will attempt both the current auth mechanism and then, if that fails, attempt tosudo
and do socket-based auth as root.If that's difficult, we should at least add instructions to the end of the Install MySQL section saying something like this:
Steps to Reproduce
sudo su
to swap to theroot
user.Log file
Okay!
Technical details
This is automatically output by Ghost-CLI if an error occurs, please copy & paste:
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v16.19.1
Ghost Version: 5.43.0
Ghost-CLI Version: 1.24.0
Environment: production
Command: 'ghost install'
Bug submission checklist
Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root-password';
to change theroot
user to use password auth. Nonetheless, I still consider the docs as they currently exist to be broken, because they don't instruct you to set a password like this and it's a necessary step.The text was updated successfully, but these errors were encountered: