Forgot the SA password for your SQL Server 2012 instance? If you have tried to access the database too many times with wrong passwords, the SA account may be locked out. In this tutorial we’ll show you two options to take control of your SQL Server 2012 by either adding a sysadmin account or resetting the SA password.

Option 1: Reset SQL Server 2012 Password in Single-user Mode

Launch the SQL Server Configuration Manager utility. Look for your SQL Server 2012 instance and stop the service. Open a Command Prompt with admin privileges, run the following command to start SQL Server 2012 in single-user mode:

net start MSSQL$SQLEXPRESS /m"SQLCMD" Be sure to change MSSQL$SQLEXPRESS to the service name of your SQL Server instance. Each instance has its own SQL Server service. The service name could be found within the Windows Services panel (services.msc). Use the sqlcmd command to connect to your SQL Server 2012 database locally. If your SQL Server is installed on a remote computer, make sure you substitute the . (dot) with the host name of that server.

sqlcmd -E -S . Type the following SQL statement to create a new account and granting it any server-level permission.

CREATE LOGIN tom WITH PASSWORD = 'P@ssw0rd'

GO

ALTER SERVER ROLE sysadmin ADD MEMBER tom

GO Type exit to quit sqlcmd. Restart your SQL Server 2012 service to get out of the single-user mode. You can then connect to the database using the new login you just created.

Option 2: Offline Reset SQL Server 2012 Password

SQL Server creates the user’s password hash, which is stored in the master database (sysxlogins). With SQL Server Password Changer you can unlock / reset SQL Server 2012 passwords for the SA and other user accounts. Here’s how: