SQL Server Error 18456: Complete Fix Guide

Common SQL Errors

Authentication

SQL Server Error 18456 signals a login failure caused by incorrect credentials, disabled accounts, or missing permissions.

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 indicates that the server refused a login attempt. Check the failure state in the error log, verify credentials, enable or unlock the login, and grant the correct permissions to resolve the issue.

Typical Error Message

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

Explanation

What is SQL Server Error 18456?SQL Server raises Error 18456 when a connection attempt fails authentication. The message is generic, but the SQL Server Error Log includes a Failure State code that pinpoints why the login failed.Resolving Error 18456 is critical because repeated login failures lock out users, break applications, and may signal security threats.

What Causes This Error?

Incorrect passwords trigger Failure State 8, the most common reason. SQL Server simply declines the login when the supplied password does not match the stored hash.Disabled or locked accounts cause Failure State 7 or 23. Security policies or too many bad attempts can deactivate the login until an admin intervenes.Missing server-level permission CONNECT SQL raises Failure State 11 or 12. Even valid credentials fail if the account lacks CONNECT rights.Wrong default database (Failure State 18) breaks logins that no longer have access to their default DB after migrations or drops.

How to Fix SQL Server Error 18456

Read the SQL Server Error Log first. The Failure State clarifies the root cause, guiding a targeted fix.For wrong passwords (State 8), reset the password in SSMS or ALTER LOGIN and update application connection strings.For disabled logins (State 7), re-enable the account with ALTER LOGIN ENABLE, or unlock with ALTER LOGIN … WITH PASSWORD.Grant CONNECT SQL for permission issues (State 11/12) using GRANT CONNECT SQL TO [login]; then retry the connection.Change the default database (State 18) with ALTER LOGIN … WITH DEFAULT_DATABASE = master or another accessible DB.

Common Scenarios and Solutions

Application pools often store outdated passwords. Update the app config and recycle the pool after resetting the login.SQL Authentication logins disabled during audits must be re-enabled and given strong passwords before production release.Migrated databases change file paths. Setting a safe default database prevents users from pointing to a dropped DB.

Best Practices to Avoid This Error

Enforce strong password policy and scheduled rotations to minimize forgotten credentials.Monitor the SQL Error Log with Alerts or Galaxys AI copilot to detect repeated State 8 or 11 failures early.Automate permission reviews during deployments, ensuring each login keeps CONNECT SQL and database access.

Related Errors and Solutions

Error 4060  Cannot open database requested by the loginoccurs when the database itself is offline or inaccessible.Error 233  No process is on the other end of the pipehappens when SQL Server stops accepting native client connections.Error 18451  Login is disabledexplicitly tells you the login is turned off and must be enabled.Error 18470  Login failed due to password expirationrequires a password reset before reconnecting.

Common Causes

Bad password or typo (Failure State 8).

Login disabled or locked after policy violations (State 7, 23).

CONNECT SQL permission revoked (State 11, 12).

Default database unavailable (State 18).

SQL Server in Windows Authentication mode only.

Related Errors

Error 4060 – database unavailable;Error 233 – no process on the other end of the pipe;Error 18451 – login is disabled;Error 18470 – password expired

FAQs

How do I find the Failure State for Error 18456?

Open the SQL Server Error Log in SSMS or run xp_readerrorlog; the line containing 18456 shows a State number that identifies the exact cause.

Does Error 18456 always mean a wrong password?

No. A wrong password is only State 8. Other states point to disabled logins, missing permissions, or default database issues.

Can I fix Error 18456 without sysadmin rights?

You need ALTER LOGIN or securityadmin privileges to reset passwords or enable logins. Basic users cannot resolve the error.

How does Galaxy help?

Galaxy’s AI copilot reads error logs, surfaces the Failure State, and suggests the exact ALTER statements to fix the login, saving time.

Check out some other errors

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