this is a common problem we will be facing in our test environment or in our test,personal and dev environment servers.
, there are 3 steps to recover the lost password,
Open the SQL Server Management Studio. go to the security tab in the server objects. click on logins select the user you want to change the password.type the desired password in the password column, check the image attached
In Some environments you dont have SQL Server Management Studio Installed in the server then you can use osql to resolve the issue.check the image attached
If you have forgot /removed the Windows Authentication then Start SQL Server in SIngle User mode by changing the start up parameters with -m