SQL Server Error 18456: Complete Troubleshooting Guide

Common SQL Errors

Authentication

Error 18456 means SQL Server rejected the connection because the supplied login could not be validated.

Microsoft SQL Server
Sign up for the latest in common SQL errors from the Galaxy Team!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

What is SQL Server error 18456?

SQL Server Error 18456 occurs when the server rejects a login attempt. Check the State code in the error log to pinpoint the cause—most often wrong password, disabled account, or missing permissions—then correct credentials or grant access to resolve.

Typical Error Message

Login failed for user '<user>'. (Microsoft SQL Server, Error: 18456)

Explanation

What Is SQL Server Error 18456?SQL Server throws Error 18456 when it cannot authenticate the login request. The message appears in client tools, while the SQL Server error log shows a State code that explains why the login failed.Error 18456 blocks all activity for the session, so administrators must resolve it quickly to restore connectivity for users and applications.

What Causes This Error?

The most common trigger is an incorrect password or mismatched authentication mode. SQL Server checks the credentials against Windows or SQL logins and returns Error 18456 if validation fails.Other causes include disabled or locked accounts, expired passwords, missing database access, orphaned users after restores, and service accounts without the CONNECT permission.

How to Fix SQL Server Error 18456

Start by reviewing the error log. The State code narrows the problem: 1 = wrong password, 2 = user not allowed, 5 = account disabled, 6 = password expired, 7 = login disabled, 8 = password mismatch, 11/12 = database unreachable.Use T-SQL or SSMS to correct permissions, enable the account, reset the password, or map the login to the target database. Re-test the connection after each change.

Common Scenarios and Solutions

Application pool identity fails after password change—reset the credential and recycle the pool.Restored database rejects logins—run sp_change_users_login or ALTER USER ... WITH LOGIN to link users to logins.Mixed authentication disabled—switch to SQL + Windows mode in server properties or convert the connection string.

Best Practices to Avoid This Error

Enforce strong password policies and rotate secrets with a vault. Monitor the error logs for repeated 18456 events and alert the DBA team.Use contained databases or Azure AD authentication to reduce orphaned logins. Store connection strings securely and automate deployment with CI/CD secrets.

Related Errors and Solutions

Error 233 indicates the server dropped the connection after Error 18456; fix the login first. Error 4064 points to an unavailable default database—set a valid default or change it in the connection string.Error 18451 surfaces when the login is valid but the user is not associated with a trusted SQL Server connection; re-map the login or enable contained authentication.

Common Causes

Incorrect password or username supplied in the connection string.

SQL login disabled, locked, or password expired.

Windows account removed from Active Directory or relevant group.

Server set to Windows-only authentication but client forces SQL login.

Default database offline, unavailable, or the login lacks access.

Orphaned user after database restore or migration.

Related Errors

• Error 233 – No process is on the other end of the pipe after failed login.• Error 18451 – Login is not associated with a trusted SQL Server connection.• Error 4064 – Cannot open user default database.• Error 4062 – Login failed while opening a database that does not exist.

FAQs

Why does SQL Server show State 1 for Error 18456?

State 1 is a generic code shown to the client. Check the SQL Server error log for the real State value that pinpoints the exact cause.

How do I see the State code for Error 18456?

Open the error log in SSMS or run xp_readerrorlog. Search for 18456 entries; the State column appears after the error number.

Does Mixed Mode authentication fix Error 18456?

Mixed Mode allows both Windows and SQL logins. It solves errors caused by Windows-only mode but not issues like wrong passwords or disabled accounts.

Can Galaxy help me avoid Error 18456?

Galaxy’s AI copilot audits connection strings, flags mismatched authentication modes, and suggests T-SQL fixes directly in the editor, reducing 18456 incidents.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie
BauHealth Logo
Truvideo Logo