SQL Server Error 18456: "Login failed" — What the State Code Actually Means
In Error 18456, the State code reveals the actual root cause. Specific fixes for State 5, 8, 11, 18, 38, and 40, with ERRORLOG extraction scripts.
The error string is a symptom, not the root cause. Do not restart the server blindly. Run the diagnostic queries below to pinpoint the actual failure mode.
▸Symptom
Login failed for user 'app'. Reason: Password did not match that for the login provided.The critical detail is the internal State number stored in ERRORLOG:
- •State 5: Login does not exist.
- •State 8: Password mismatch or server configured for Windows Auth only.
- •State 11/12: Login is disabled or server access denied.
- •State 38/40: Default database unavailable or offline.
▸Diagnostics
EXEC xp_readerrorlog 0, 1, N'18456';
SELECT SERVERPROPERTY('IsIntegratedSecurityOnly') AS windows_only_mode;- •SQL Server Error 1205 Deadlock Resolution
- •Validated versions: SQL Server 2019 / 2022
Other Database Error Triage Playbooks
Other battle-tested diagnostic guides for high-severity database errors.
SQL Server Error 1205 Deadlock: Graph Extraction and Prevention
Extracting the deadlock graph from the system_health Extended Events ring buffer, understanding victim election, and architectural resolution.
SQL Server Pool Timeout: Connection Pool Exhaustion Fix
Difference between connection pool timeout and query command timeout, detecting connection leaks, and .NET DbContext architectural fixes.
SQL Server Msg 9002: Transaction Log Full Resolution Guide
Decoding log_reuse_wait_desc in Error 9002, tailored resolutions for LOG_BACKUP, ACTIVE_TRANSACTION, and AVAILABILITY_REPLICA, plus VLF tuning.