Am no expert in this area, yet your request to the community deserves some response:
Apple support provides helpful articles online:
Eg:
For a Mac using macOS Mojave MacOS 10.14.6) or earlier:
See how to: Change or reset the password of a macOS user account in macOS Mojave or earlier - Apple Support
Else: This is Apple Support's newest article for what to do: If you forgot your Mac login password - Apple Support
Above article also says:
" If you can’t reset your login password:
If no other solution works, you can regain access to your Mac by erasing it. This will permanently remove each user account, its password and its data from your Mac." ( Includes "How to": step by step instructions)