Use the Reset Password assistant
You should now see the utilities window, which shows options such as restoring from Time Machine, reinstalling macOS, and using Disk Utility.
From the Utilities menu in the menu bar, choose Terminal.
In the Terminal window, type
resetpassword
, then press Return to open the Reset Password assistant.If you're asked to select an admin user you know the password for, click “Forgot all passwords?”.
At the Reset Password window, click Deactivate Mac, then click Deactivate to confirm.
If you see an Activation Lock window, enter your Apple ID email and password, then click Next.
At the Reset Password window, enter your new password information, then click Next.
If this window shows multiple user accounts, click the Set Password button next to each account name, then enter the new password information for each account.When the password reset is completed, click Exit.
Choose Apple menu > Restart, then log in with your new password.