How to reset mysql root password in Ubuntu

In order to reset root mysql password follow this procedure

1. Stop mysql service

# service mysql stop

2. Start mysql service skipping grant tables

# mysqld_safe --skip-grant-tables &

3. In a different console login as root with no password

$ mysql -u root

4. Within the mysql console execute

mysql> use mysql;
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

5. Stop mysql service

$ service mysql stop

6. Start mysql service

$ service mysql start

7. Login with the new password

$ mysql -u root -p