mysql -u root doesnt work but sudo mysql -u root does, why?
Solution 1:
- Access with sudo:
sudo mysql -u root -p
- Delete the root user:
drop user 'root'@'localhost';
- Create the root user again:
create user 'root'@'%' identified by 'your_password';
- Give permissions:
grant all privileges on *.* to 'root'@'%' with grant option;
- Update permission tables:
flush privileges;
- Exit MYSQL and try to reconnect without sudo.
Font: can't login as mysql user root from normal user account in ubuntu 16.04