Fix SQL Server Error 18456: “Login Failed for User ‘sa'” (Troubleshooting Severity 14 States)

Microsoft SQL Server Error 18456, Severity: 14 with the message “Login failed for user ‘sa'” occurs when the SQL Server Database Engine rejects an authentication attempt using the system administrator account. To protect against malicious credential probing, SQL Server intentionally presents a generic error to client applications, concealing the exact cause behind a hidden “State” code inside the SQL Server Error Log. In 90% of instances, this failure is caused by either State 58 (the SQL Server instance is configured in Windows Authentication Mode only instead of Mixed Mode) or State 8 (an incorrect password was entered). You can permanently resolve Error 18456 by enabling Mixed Mode Authentication in SSMS, enabling the ‘sa’ login, and restarting the SQL Server service.
Error: 18456, Severity: 14, State: X.Table of Contents
1. Common SQL Error 18456 State Codes Decoded
| State Code | Exact Cause | Resolution |
|---|---|---|
| State 58 | Instance is in Windows-only auth mode | Enable SQL Server and Windows Authentication mode |
| State 8 | Password mismatch / invalid password | Reset ‘sa’ password |
| State 7 | The ‘sa’ account is disabled | Enable login under Security > Logins |
| State 11 / 12 | Target database is inaccessible / offline | Change default database to master |
2. Step 1: Enable Mixed Mode Authentication (Fix State 58)
- Connect to SQL Server using Windows Authentication in SSMS.
- Right-click the server instance in Object Explorer and select Properties.
- Switch to the Security page.
- Under Server authentication, select SQL Server and Windows Authentication mode. Click OK.
3. Step 2: Unlock and Enable the ‘sa’ Account
- In Object Explorer, expand Security > Logins.
- Right-click
saand select Properties. - On the Status tab, ensure Permission to connect to database engine is set to Grant and Login is set to Enabled.
4. Step 3: Reset ‘sa’ Password via T-SQL
Run this script in a New Query window:
ALTER LOGIN [sa] WITH PASSWORD = ‘YourStrong#Password2026’, CHECK_POLICY = OFF;
ALTER LOGIN [sa] ENABLE;
GO
5. Step 4: Restart the SQL Server Service
Authentication mode changes do not take effect until the SQL service restarts. In SSMS, right-click the root server node and select Restart.
Enterprise Database Reliability with SortedKeys
Looking for fully supported Microsoft database licensing? SortedKeys offers genuine SQL Server and Windows Server retail keys with expert technical guidance.
View SQL Server Licenses →6. Frequently Asked Questions
What if I am locked out of Windows Authentication as well?
You can start SQL Server in Single-User Mode (net start MSSQLSERVER /m"SQLCMD") from an elevated command prompt. This permits members of the local Windows Administrators group to connect and reset login permissions.



