mysql -u root -p
Access denied for user 'root'@'localhost' (using password: NO)
# kill the running mysql process
sudo service mysql stop
# start mysql in safe mode and skip grant tables
sudo mysqld_safe --skip-grant-tables --skip-networking &
# log in with root
mysql -u root