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

How to fix it

  1. Check the SQL Server error log for the specific State number — it tells you the real cause.
  2. If password-related, reset it: ALTER LOGIN [user] WITH PASSWORD = '...'
  3. If the login doesn't exist, create it and map it to the target database with the right role.
  4. 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 →

Related