Here is a handy report on how to reset your root password if you have console access.
How to recover your lost root password
In CentOS, it’s possible to have the scripts that run from the initramfs debug the shell at certain points, provide a root shell, and continue when that shell exists.
First, reboot the system.
Interrupt the boot loader countdown by pressing any key.
Move the cursor to the entry that needs to be booted.
Press “e” to select that entry. After selecting that entry, the below kernel commands will appear.
In the kernel command line, move the cursor to the line that starts with linux16.
Press the “End” key to move the cursor to the end of it. Type “rd.break” (This will break just before control is handed from the initramfs to the actual system).
Then press “Ctrl+x” to save those changes. The Initramfs debug shell will appear.
Next, we have to provide read and write permissions to /sysroot by typing the below command:
mount -o remount,rw /sysroot/
Now switch into chroot jail.
In here, /sysroot is treated as the root of the file system tree.
Next you’ll set a new root password.
And relabel the files.
Finally, type “exit” twice.
The first one will exit from the chroot jail.
The next one will exit from the initramfs debug shell and reboots the system.