SQL Server error 18456: what do the login failed states mean?
Resolved SQL
VQ
Victor Quinn
October 26, 2026
2 replies
2,127 views
Reviewed by moderators
2 participants

My app can not connect and the SQL Server log shows "Login failed for user 'appuser'. Reason: Password did not match" with State 8. Other times I have seen State 5 and State 38. What do the numbers mean?

Accepted answer
Marked as the solution to this question

The message the client sees is vague on purpose, but the server error log has the real state. The common ones:

• State 5: the login does not exist.
• State 7: the login is disabled.
• State 8: the password is wrong.
• State 11 or 12: the login is valid but does not have server access.
• State 38 (SQL 2008 and later): the database named in the connection string is missing or the login has no access to it.
• State 58: the server accepts only Windows authentication, while the client uses a SQL login.

For your State 8, reset the password with ALTER LOGIN appuser WITH PASSWORD = 'new password'; and update the app's connection string. Also check that the connection string does not contain an old password cached in a config file.

The config file had an old password. Updated and the login works. Thanks.