If you forget your password, you can use the following methods:
Press the command+S key combination on the keyboard first, and then you will enter the command prompt state, which is a bit like DOS.
Second, press enter. When you see root#, type: fsck -y? Command, and then press enter
Keep typing: mount -uaw/, and then press enter.
Enter this command again: RM/var/db/. Apple set to press enter.
Enter again: restart enter. Then the computer will restart.
As shown in the figure, just like the new machine after restart, just follow the prompts to reset it. The previous data will not be lost.