MySQL root login problem. Access denied

17. janvāris, 2019

Starting from MySQL version 5.7 you can not login in from command line like this

mysql -u root

It gives error Access denied

Howerver you can login with sudo

sudo mysql -u root

To fix this Drop all root users

create user 'root'@'%' identified by '';
grant all privileges on . to 'root'@'%';
flush privileges;

Now you can login from command line

mysql -u root