Sometimes passwords are lost …, however in most cases we can find a workaround and reset the missing password.

First stop MySQL service, then we can start it in background without loading grant table.

$ mysqld_safe --skip-grant-tables --skip-networking &

Now we can connect to MySQL without password … Update root password:

$ mysql -e " \
  UPDATE mysql.user \
  SET \
    authentication_string = PASSWORD('new_password') \
  WHERE \
    User = 'root' \
  AND \
    Host = 'localhost' \
;"

All done, time to stop current running instance and start MySQL service as normal.

$ pkill mysql