I was unable to log into a Macbook Pro the other day where I work because I did not have the admin password and so I looked up how to bypass this. I came across these steps across multiple sites so I figured I would document this little how to.
This was tested with Catalina.
Hold Command and S then turn on the computer
When recovery comes up open the terminal by clicking on Utilities menu and then Terminal
Type the command to mount the hard drive.
Mount -uw /
You will need to cd to /Volumes
Type in ls -l
It will show you the partitions.
Change directory into the bootable volume
Run this command
cd var/db
Then you will need to run this command.
‘rm .AppleSetupDone’
Reboot the system and it will come with the new user wizard and allow you to create a new admin user.