If you have forgotten root user password on your CentOS 6 machine, you can reset the password to new value, without knowing the old one, by booting the machine to single user mode, and resetting the password with passwd
command.
Boot to single user mode
During the CentOS boot process, you will be presented with a countdown before CentOS boot process actually begins to load the OS.
Press any key to enter the GNU GRUB menu.
On the GNU GRUB menu highlight the kernel you want to boot, and press ‘e’ key to edit the kernel commands before booting.
Once you have entered the kernel edit mode, find the line beginning with kernel, and highlight it, and press ‘e’ key to edit it.
On the end of the line add the word ‘single’, with white space before ‘single’, and press ENTER to accept the change.
Boot the machine with the edited kernel argument, and you will be logged in as root in single user mode.
Now just issue passwd
command, and enter the new password two times, when asked.
Once you have changed the password, reboot the machine, and log to it with your new root password.