This step will work on especially on CentOS, RedHat, and Fedora. Make sure you didn’t put any password for your GRUB during installation or this tutorial won’t be any help.
1) Turn on the server until the loading screen appears.
2) While on countdown, press any key to cancel the countdown
3) Select your current Linux kernel:
4) Select the Kernel, then press “e” to edit the line:
5) Go to the end of the line, press the spacebar once, then add the word “single” like below:
6) Press Enter and press “b” to boot that argument that you just modified
7) Wait till it finished loading, then you are able to start typing. Then you may change your password like below:
8) When done, type “reboot” and you are able to use the new password.