After you sign in to your Mac account with your Apple ID, you can use it to reset your administrator password. Otherwise, you can use recovery mode and run the password reset utility. You can also reset your password if you sign in with a different administrator account. If you know your password, you can change it in the "Users and Groups" menu.
Steps
Method 1 of 4: Using an Apple ID

Step 1. Try to enter the wrong password three times
If you enabled this option when creating your account, then use your Apple ID to reset your password. This method will only work if this option has been enabled.
If you have access to a Mac, you can enable this option by opening the Apple menu and choosing System Preferences. Click on the "Users and Groups" option and then select your account. Click on the lock button to unlock the settings, and then click on the "Allow user to reset Apple ID password" option

Step 2. Reset your password by clicking on the link that appears
It will appear only after you enter the password incorrectly three times. If this option does not appear, then it is not enabled in your account, and you will have to use another method from this article.

Step 3. Enter your Apple ID password
To reset your admin password, you must enter your Apple ID password. This is the identifier associated with your Mac account.

Step 4. Create a new administrator password
After you enter your Apple ID password, you will be asked to create a new administrator password. To create it, you will need to enter a new password twice.

Step 5. Use the new password after rebooting the system
After you create a new administrator password, you will have to restart your computer. When the computer restarts, enter the new password to log in.

Step 6. Create a new Keychain
As soon as you log in using the new password, you will be notified that you have no access to the Keychain Access. This is due to the fact that the Keychain was protected only by the previous administrator password, and, for security reasons, access to it with the new password is limited. You will have to create a new Keychain for your passwords.
Method 2 of 4: Recovery Mode

Step 1. Restart your computer
If you can't change your password using your Apple ID, reset it using Recovery Mode. Enter recovery mode while the computer is starting up.

Step 2. Pinch
⌘ Command + R as soon as you hear the beep.
Continue holding the keys until you see the loading bar. This will start the recovery mode. The download may take some time.

Step 3. Click on the "Utilities" menu and select "Terminal"
The Utilities menu is at the very top of the screen.

Step 4. Enter
resetpassword and press the key ⏎ Return. This will launch the "Recovery Mode" utility.

Step 5. Select a hard drive
If your Mac has multiple hard drives, select the one that contains the operating system. It is usually called “Macintosh HD”.

Step 6. Select the user account for which you want to change the password
Select an account from the drop-down menu.

Step 7. Create a new administrator password
Enter your password twice to create one.

Step 8. If you want, you can also enter a password hint
It can be displayed if you have difficulty logging into your account.

Step 9. Click on the "Save" button to save the new password
You will be able to use the new password after rebooting the system.

Step 10. Click on the Apple menu and select OS X Utilities → Quit OS X Utilities
Reboot your computer when prompted by the system. This will restart the system and apply the new password.

Step 11. Log in with the new password
After you restart your computer, select your user account and sign in using your new password.
Method 3 of 4: Using a second administrator account

Step 1. Log in with a second administrator account
To do this, you must have a second account with administrator rights on your computer, and you must know its password.
If you are logged in with your account, log out and then select the second administrator account

Step 2. Click on the Apple menu and select System Preferences
This will open the system options.

Step 3. Select the "Users and Groups" option
All users will be displayed on the screen.

Step 4. Click on the lock at the bottom of the screen
This will allow you to make changes to the Users and Groups settings. You will be asked to enter the administrator password for the account you are using.

Step 5. Select the first account
It will be listed in the menu on the left. You will see the account settings appear.

Step 6. Click on the "Reset password" button
This will allow you to create a new password for your account.

Step 7. Create a new administrator password for the original account
To confirm the creation of a new password, you will need to enter it twice. Click on the "Change Password" button to save it.

Step 8. Log out and then log back in to the first account using the password you just created
You will be able to log into your account by entering the password you just created.

Step 9. Create a new "Keychain"
When you sign in with your new password, you will be asked to update your Keychain Access or create a new one. You will not be able to update the new password because you do not know the previous one. You will have to create a new Keychain which you will use later.
Method 4 of 4: Change your password if you know it

Step 1. Click on the Apple menu and select System Preferences
This will open the system options. This method of changing the password will only work if you know the current password. If you cannot remember it, then use another method from this article.

Step 2. Select the "Users and Groups" option
This will allow you to change user preferences.

Step 3. Click on the padlock in the lower left corner and enter your current password
Here you can change the system parameters.

Step 4. Select your account and click "Change password"
A new window will appear where you can change your password.

Step 5. Enter your old password in the first field
This is the password you are currently using.

Step 6. Create a new password
You will have to enter it twice to confirm the new password. Click on the "Change Password" button to save it.

Step 7. Add a hint (optional)
You can add a password hint that will be displayed if you have difficulty logging in. Do this so that you don't have to reset your password again if you forget it.

Step 8. Start using your new password
The system will immediately accept the password. Use it with every system request.
Advice
- Write down the password somewhere inconspicuous (for example, on the inside cover of your favorite book) to prevent accidental locking of the system.
- If FileVault is enabled on your computer, you cannot unlock the Reset Password utility without the confirmation code and password that you received when you initially set up FileVault. Without this information, you will not be able to access your files.