Password assistant (FileVault must be on)
One way to reset your password is using set Password assistant (FileVault must be on).
If FileVault is on, follow these steps to reset your password:
Wait up to a minute at the login screen, until you see a message saying that you can use the power button on your Mac to shut down and
start up again in Recovery OS. If you don't see this message,
FileVault isn't on.
Press and hold the power button until your Mac turns off.
Press the power button again to turn on your Mac.
When the Reset Password window appears, follow the onscreen instructions to create a new password. If you need to connect to
Wi-Fi, move your pointer to the top of the screen and use the Wi-Fi
menu to connect. To exit without resetting your password, choose Apple
menu > Restart.

When done, click Restart.
If you were able to reset your password with the Reset Password assistant, log in to your account using your new password.
Determine whether to create a new login keychain.
(Source)
Reset using your Recovery Key (FileVault must be on)
If FileVault is on and you have a recovery key you can use that to reset your password:
At the login screen, keep entering a password until you see a message saying that you can reset your password using your Recovery
Key. If you don't see the message after three attempts, FileVault
isn't on.
Click the arrow next to the message. The password field changes to a Recovery Key field.
Enter your Recovery Key. Use uppercase characters, and include the hyphens. Follow the onscreen instructions to create a new password,
then click Reset Password when done.
Determine whether to create a new login keychain.
Reset using Recover Mode
You can reset your password from the terminal using Recovery Mode:
Turn off your Mac (choose Apple > Shut Down).
Press the power button while holding down Command + R. The Mac will boot into Recovery.
When you see the load bar appear you can let go of the keys. It may take a few minutes to load.
Select Disk Utility and press Continue.
Choose Utilities > Terminal.
Enter resetpassword
(all one word, lower-case letters) and press Return.
Select the volume containing the account (normally this will be your main hard drive).
Choose the account to change with Select the User Account.
Enter a new password and re-enter it into the password fields.
Enter a new password hint related to the password.
Click Save.
A warning will appear that the password has changed, but not the Keychain Password. Click OK.
Click Apple > Shut Down.
(Source)