error: 'Access denied for user 'root'@'localhost'
Sound familiar?
Using MySQL on Ubuntu you may have seen that once in a while. It can happen when you are using MySQL as the root user without a password, it doesn't like that and "additional security" kicks in, shutting you out of the mysql shell.
It is recommended to use a different user and a password, which makes a lot of sense anyway, but for local development it can be convenient to not do so. Here is what helps fixing this for me:
$ sudo mysql -u root
mysql> UPDATE mysql.user SET plugin='mysql_native_password';
mysql> FLUSH PRIVILEGES;