SA and Windows Authentication cannot log on to SQL Server for some reason, and you can modify the SA password in exclusive mode
Stop the SQL Server service in Service Manager, then open the command line, go to the SQL Server installation directory, and enter Binn
Execute Command sqlservr.exe-m
Open a command-line window after startup to enter command sqlcmd
Execute command to make SA account available
ALTER LOGIN SA ENABLE;
GO
Modify the sa password (UNLOCK requires more than 2008 versions)
ALTER LOGIN sa with password= ' new password ' Unlock,check_policy=off,check_expiration=off;
GO
Create a new System account
CREATE LOGIN DBAdmin with PASSWORD = ' [email protected] '
Goexec sp_addsrvrolemember DBAdmin, sysadmin
GO
Enter quit after completion
Close all command-line windows
Start SQL Server service in Service Manager, you can log in with SA account and add a Windows account
Solution for SQL Server 2008 forgetting the sa password