ESXi 5.x and ESXi 6.x
Reinstalling the ESXi host is the only supported way to reset a password on ESXi. Any other method can lead to a host failure or an unsupported configuration due to the complex ESXi architecture. An ESXi does not have a service console. This locking aims to improve the security of the host ski against security breaches and increase availability.
Very Important at the time of installation of ESXI select the installation preserving the datastore.
ESXi 3.x and 4.x
Note: This section does not apply to ESXi.
To change the password for the root user on an ESX 3.x or ESX 4.x host:
Reboot the ESX host.
When the GRUB screen appears, press the space bar to stop the server from automatically booting into VMware ESX.
Use the arrow keys to select Service Console only (troubleshooting mode).
Press the akey to modify the kernel arguments (boot options).
On the line presented, type a space followed by the word single.
Press Enter. The server continues to boot into single-user mode.
When presented with a bash prompt, such as sh-2.05b#, run the passwd command.
Follow the prompts to set a new root user password..
When the password is changed successfully, reboot the host using the reboot command and allow the ESX host to boot normally.
ESXi Server 2.x
Note: This section does not apply to ESXi.
To change the password for the root user on an ESX 2.x host, you must reboot into single-user mode. To do this, perform these steps:
Reboot the ESX host.
When the LILO screen appears, press the space bar to stop the server from automatically booting into VMware ESX.
At the LILO prompt select linux, adding the -s to the end of the line. For example: linux -s.
Press Enter. The system begins to boot. The server continues to boot into single-user mode.
When presented with a bash prompt, such as sh-2.05b#, run the passwd command..
Follow the prompts to set a new root user password.
When the password is changed successfully, reboot the host using the reboot command and allow the ESX host to boot normally.
When the system has finished booting, you can log in as the root user using the new password.
Additional Information in the VMware Knowledge Base Article.