MySql - unable to connect as root

Solution 1:

Connect with sudo mysql -u root -p and it will prompt you for the password. The key here is the -p option. You can also provide the password as part of the command with the -p option, but that is considered a security risk, since the password will be stored in clear text in your commands history.