If you forgot your root password, then it’s not a big deal. Below are the methods to reset root password in different linux distributions.
Step 1: Power on Redat/CentOS 7 Server
First power on your Redhat/CentOS 7 server. At the boot menu, select the Kernel you want to boot up and press e to edit the selected boot entry.
Find the line rhgb quiet :
and replace it with init=/bin/bash
Then press CTRL+X to enter into single user mode.
Step 2: Mount / partition
# mount -o remount,rw /
Step 3: Change root password
# passwd root
Step 4: Create File
# touch /.autorelabel
Step 5: Execute Command
# exec /sbin/init