Reset the mysql root user password

Stop the mysql server:
sudo service mysql stop

Start mysql in save mode and make it skip evaluating the grant tables (thats where password hashes are stored):
/usr/bin/mysqld_safe –skip-grant-tables &

Now you can login as root without a password, using the database mysql:
mysql -u root mysql

I prefer to generate passwords via the following command. It will have a random length between 50 and 80 characters. If you want it to contain symbols as well, use the -y flag. However that does not play well with mysql. As far as I know, the maximum allowed password length for mysql is 80 characters.
pwgen -s `shuf -i 50-80 -n 1` 1

update user set Password=PASSWORD('your_new_root_password') WHERE User='root';
flush privileges;
exit

As you put the mysqld_save command to the background (via the &), get it to the foreground again:
fg [CRTL + c]

Now you can start the mysql server again and login with your new password:
sudo service mysql start && mysql -u root -p

I advise you to never use mysql -u root -p3l3jk543j55jk3kljlj4353 on the command line, as the command will persist in your bash history + it will be visible in the process table. You can delete your bash history when you type a password to the command prompt and hit enter via:
history -c

Reset a mysql user password

To reset any users password login to mysql as root user using the mysql database:
mysql -u root -p

SET PASSWORD FOR 'user'@'hostname'= PASSWORD('new_password');
flush privileges;
exit