Note the process is a little different depending on which version of macOS you are using. Follow these steps to reset your Mac password from another account.
If you know (or can find out) the password to another account for the Mac you can use this account to reset your password.
Do you share the Mac with another person – some people do, in these days of remote working and hot-desking – and do they have their own account? Is there an administrator who looks after your work Mac? An IT guy (or girl) who might be able to log on? Or do you have a different user account on the Mac that you do know the password to? The only problem here is that if the other user doesn’t have Admin rights on the Mac they will not be able to change the password for you.