I have a brand new installation of MySQL on Ubuntu 20.04.
During the installation I picked a password for root. After the installation, I did the following:
sudo mysql -u root
It logged me in without asking for password. Then:
mysql> USE mysql; mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> exit;
I thought by doing this it would ask for my password on the next login. However, now when I try to log in it gives me:
user@machine:~/Work$ mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I type my correct password and cannot login.
How can I solve this and achieve what I trying to setup (login with root but having to type my password)?
Iḿ on version
mysql Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))