I\'m setting up a new server and keep running into this problem.
When I try to login to the MySQL database with the root user, I get the error:
This has happened to me as well. The problem is with the mysql repo that comes already with the linux distro. So when you simply do:
$ sudo apt install mysql-server
it installs mysql from their default repo which gives this problem. So to overcome that you need to uninstall that installed mysql
$ sudo apt remove mysql* --purge --auto-remove
Then download mysql repo from official mysql website MySQL APT Repo Follow their documentation on how to add repo and install it. This gives no issue. Also as answered by @zetacu, you can verify that mysql root now indeed uses mysql_native_password plugin