Same instructions to your other and same question
https://discussions.apple.com/thread/254449563
Reset Computer Password for the Administrator Account Password
Intel Computer
1 - Shutdown the computer
1A - Restart computer and immediately hold the two keyboard combo Command r
2 - Top Tool Bar >> Utilities >> Terminal
3 - Type resetpassword as one word and no spaces
4 - Press Return key
5 - Follow the prompts and remember the New Password
Apple Silicon M1 / M2 Computer
1 - Choose Apple menu > > Shut Down.
2- Done attempt a Restart to access this feature. The computer Must be Shutdown and pause before moving forwards
3 - Press and hold the power button on your Mac until you see “Loading startup options.”
4 - Click Options, then click Continue.
5 - Top Tool Bar >> Utilities >> Terminal
6 - Type resetpassword as one word and no spaces
7 - Press Return key
8 - Follow the prompts and remember the New Password