I have just setup a new vps with Ubuntu 18, I did a fresh installation of mysql-server:
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation
In this menu, I typed in my new root password (and confirm) Remove anonymous users? Yes Disallow root login remotely? Yes Remove test databases and access to it? Yes Reload privileges table now? Yes
And done! ...or not
I attempted to login using mysql -u root -p but it kept telling my access denied, for a second I was confused, then I realized I probably needed to login using sudo, so I did.
But now, using "mysql -u root" or "mysql -u root -p" (using ANY password) I can login just fine?!
I am completely dumbfounded.. I have attempted doing alot of different things, like using a query to alter the root password, but nothing seems to work. I can always log in with any password (or none).. And this is a completely fresh mysql installation (I removed and reinstalled it 3 times now to see if I do something differently..)
The only thing I noticed that seemed different, is that in online tutorials on how to install mysql-server the first question in "mysql_secure_installation" it should ask you if you want to set a password for root, which I did not get asked for, just prompted to enter the new password.
I tried googling this issue, but could only find "solutions" for the reverse (people either not able to login, or wanting to set an always correct password)
I have no idea where to go from here...