Here are steps to follow :-
1. cmd “reboot” , bios screen will appear
2. select ” CentOS Linux Server “ (don’t hit enter button)
3. press ” e “
4. search paragraph that starts with ” linux 16 ……..and ends with …….. rhgb quiet ”
5. beside rhgb quiet , type ” rd.break “ (again, don’t hit enter button)
6. press ” ctrl x ”
7. switch.root:/# will appear, type ” mount -o remount rw /sysroot ” enter
type ” chroot /sysroot ” enter. Then set new password.
8. passwd ” username “. Enter new password and hit enter button
9. make hidden file i.e. ” touch /.autorelabel “ , after that
10. type ” exit ” hit enter , again do the same and wait for system reboot.