Note that this may work in other distributions, but I have not tested this
If the root password has been fogotten, then it can be reset with access to the console.
Reboot the system
When the GRUB bootloader is seen, press e
You should now see the following screen:

At the end of the 2nd line add rd.break enforcing=0.
Note that text wrap is enabled, so be careful here. In this example "quiet" is the end of the 2nd line
'rd' is short for "ram disk" and "rd.break" means that it will put a break point in the boot sequence and drop us out in to the ram disk. "enforcing=0" is to disable SELinux. These changes are temporary and will not survive a reboot
switch_root:# prompt.mount -o remount,rw /sysrootchroot /sysroot/. This will change the apparent system root and give root access to the filesystem. You should now have a sh-4.4# prompt.passwd root and enter the new password twice.exit to exist the sh-4.4# prompt, exit again to exit the switch_root:# promptsu - to switch to root as a normal user.The recommended proceedure has changed slightly in RHEL 10. We will still need to interupt the GRUB boot.
add init=/bin/bash, press Ctrl + x to continue boot. It is probably a good idea to remove console options so that we can see what is happening.
mount -o remount,rw /
passwd
touch ./autorelabel
exec /sbin/init