The process to reset the root password when you’ve forgotten it has changed in version 7 of Redhat and CentOS Linux.
First you need to reboot and temporarily edit the Grub2 boot loader. Add the following to the end of the line starting with “Linux16”:
Boot using your changes by pressing:
The changes you’ve just made are not permanent.
Once booted, issue the following:
mount -o remount,rw /sysroot chroot /sysroot passwd
Enter your new password twice (as requested) and finish the process with the following:
touch /.autorelabel Control+Alt+Del
The system will reboot and you’ll be able to log in.