Although this is an old question, there are several of us still struggle to find an answer. At least I did. Please don't follow all the lengthy solutions. You could simply login to your mysql as root without providing any password (provided it is a fresh installation or you haven't changed the password since your installation) by adding sudo before your mysql command.
$sudo mysql -uroot -p
mysql>
This is because mysql changed the security model in one of the latest versions.
Hope this helps