How to fix non-root login to MySQL in Ubuntu?

mysql -u root
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

askubuntu.com/a/784347

See also: How to set a non-empty password to the root MySQL user in Ubuntu?