Hello.
There are many methods and links on how to reset the root password on an ESXi server. You can do a google search like reset password ESXi 6.7.
The solution recommended at the time by VMware was to reinstall the VMware ESXi (with the install preserving datastores option) with the same version and distribution you currently have and then reconfigure all your settings.
As a general precaution I suggest you perform the following steps:
1. have the ISO of the current ESXi version handy, on a USB key or CD. worst case scenario you will have to reinstall VMware ESXi and reconfigure it.
2. Move all VMs to another ESXi or get a full backup of them.
3. Have noted down all the ESXi configuration details such as IP, hostmane, DNS, Gatewy, mask, VMware licenses, HBA and virtual switch details and more data.
If in the end there is no other resource, we will reinstall the VMware ESXi from the ISO, but with the option to install but keep the existing datastore, and completely reconfigure, then add the VMs that should be in datastore.