If you have forgotten the root password on CentOS or other RHEL based Linux distributions, you can reset it easily bye following the steps below.
Boot the system to single user mode
Start the system and press any key within 3 seconds at the boot screen to enter the GRUB menu
Once you are on the GRUB menu press 'a' to modify kernel arguments.
Type in rhgb quiet single and press enter.
This will take you to a root shell. To change the password simply type the command
# passwd Changing password for user root. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully.
Type the command
reboot and press enter to reboot the system.
Login with your new password.