SQL Server Error 18456: Login Failed for User
Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456) State 8: Incorrect password
What is SQL Server Error 18456?
SQL Server Error 18456 is an authentication failure. SQL Server's error log contains the critical 'State' code which pinpoints the exact reason: wrong password, account disabled, SQL auth not enabled, or database access issue.
Common Causes
- 1
State 8: Wrong password
- 2
State 5: SQL Server login does not exist
- 3
State 16: Login does not have access to the default database
- 4
State 38: SQL Server authentication mode is Windows-only
- 5
State 11: Login is valid server login but invalid database user
- 6
State 1: Account locked out or disabled
Step-by-Step Solutions
Check SQL Server Error Log for the State code: SSMS > Management > SQL Server Logs
Enable SQL Server Authentication: SSMS > Server Properties > Security > SQL Server and Windows Authentication Mode
Reset password in SSMS: Security > Logins > right-click login > Properties > change password
Fix default database: ALTER LOGIN username WITH DEFAULT_DATABASE = [master]
Enable disabled account: ALTER LOGIN username ENABLE
For 'sa' disabled: ALTER LOGIN sa WITH PASSWORD = 'newpass', NAME = sa; ALTER LOGIN sa ENABLE;
Prevention Tips
Use Windows Authentication instead of SQL Authentication where possible — more secure
Enable SQL Server auditing to log authentication attempts
Use strong password policies: ALTER LOGIN username WITH CHECK_POLICY = ON
Store connection strings in encrypted configuration or secrets management systems
Frequently Asked Questions
How do I find the state code for SQL Server Error 18456?
How do I enable SQL Server authentication mode?
Related Errors
Still Stuck?
Ask our AI SQL Assistant or the community — get answers in seconds.