Using Solaris Software Installation disk, run command boot cdrom -s.
Once the boot process is complete, you will be in the directory /tmp/root
Make directory: mkdir <pick a name>
Mount root partition: mount /dev/dsk/<root partition> /tmp/root/<pick a name>
vi doesn't work very well with the terminal. I always change my shell to csh and set a new terminal.
csh
setenv TERM vt220
cd /tmp/root/<pick a name>/etc
vi shadow
You will see:
root:<Encrypted Password>:
Delete all characters of the encrypted password (The colons must remain) and save the file.
Reboot and login as root, no password will be needed.
Use command passwd to set root's password.