I have a new mysql server 8 install on Ubuntu 20.04, and I'm simply trying to set the root password, which is required by an application I'm trying to install. I've been at it an hour, and every website I find says the exact same thing. This is what I'm doing:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
Then I restart mysql-server just to be safe, then try and login:
mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
I have no idea what is going wrong. I do see that authentication_string for root@localhost is empty, which doesn't seem right.
Edit:
It's becoming clear that "changing the password" isn't really the issue. Something else is going on here. I'm failing to login even after setting the password with the command "sudo mysql_secure_installation".
"plugin" for root@localhost is set to "auth_socket". I don't know what that means yet, but it seems like some external process has been made responsible for authenticating that user.
Edit2:
It looks like auth_socket just checks to see if your logged in on linux as the user you are trying to log in with on mysql. That means that no non-root linux user could ever log in as root on mysql. So it seems I'll have to remove this auth_socket plugin and just switch to a normal mysql authentication method. Anybody know the best way to do this without breaking anything? Would removing the user and recreating it break a lot of stuff?