- Reboot
- Press any key after reboot when boot countdown, to go to GRUB menu
- From that menu, select the appropriate kernel version and press the ‘e’ key
- Then select the kernel /vmlinuz-… line and press the ‘e’ key
- At the end of displayed line type space and then type 1 (you can type ‘s’ or ‘single’ rather than ‘1’). Press Enter to save changes
- You should already be on the kernel /vmlinuz… line. Press the ‘b’ key to boot to these temporary options to allow you to recover your root password
- When prompted type ‘passwd’ and press enter. You will be prompted to type new password twice
- After typing new password and confirming it, type ‘reboot’ command.
Got from here