SQL Server Error 18456 — Login failed for user
Login failed for user 'X'. (Microsoft SQL Server, Error: 18456)
This is an authentication failure — SQL Server received a login attempt it wouldn't accept. The generic message is deliberately vague for security; the real reason is in the SQL Server error log, tagged with a "State" number.
Common causes
- State 8 — wrong password
- State 5 — login (or corresponding Windows account) doesn't exist
- State 6/7/11/12 — Windows login used, but not granted access / not a valid Windows account
- State 1 — generic/unknown (usually a version or config mismatch, rare in modern versions)
- State 16/23 — account exists but is disabled, or SQL Server can't access it
How to fix it
- Check the SQL Server error log for the specific State number — it tells you the real cause.
- If password-related, reset it: ALTER LOGIN [user] WITH PASSWORD = '...'
- If the login doesn't exist, create it and map it to the target database with the right role.
- Confirm SQL Server is set to the right authentication mode (Windows-only vs. Mixed Mode) if a SQL login is being rejected outright.
Paste your exact error message and log details here for a diagnosis specific to your state number.
Try error explainer free →