Skip to content
errata/docs

Error 18456

Login failed for user — SQL Server authentication

Product
SQL Server
Severity
Severity: high
Updated
Read
5 min

A generic authentication failure. The State number in the error log identifies the actual cause; the client message is intentionally vague.

Error message
Login failed for user 'app_svc'. (Microsoft SQL Server, Error: 18456)

Symptoms

  • Applications cannot connect; the client reports error 18456.
  • The SQL Server error log shows "Severity: 14, State: N".
  • Connections from SSMS succeed with Windows auth but fail with SQL auth.

Cause

  • State 5: the login does not exist.
  • State 8: the password is incorrect.
  • State 18: the password has expired and must be changed.
  • State 58: the server is configured for Windows Authentication only.

Resolution

  1. Step 1: Read the State from the error log

    The State value maps directly to a cause. Query the current log instead of relying on the client message.

    sql
    EXEC sp_readerrorlog 0, 1, N'18456';
  2. Step 2: Enable mixed mode authentication (State 58)

    Switch the server to SQL Server and Windows Authentication mode, then restart the service.

    sql
    EXEC xp_instance_regwrite
      N'HKEY_LOCAL_MACHINE',
      N'Software\Microsoft\MSSQLServer\MSSQLServer',
      N'LoginMode', REG_DWORD, 2;
  3. Step 3: Reset or unlock the login (States 8, 18)

    Reset the password and clear the lockout. Disable CHECK_EXPIRATION only for service accounts with managed rotation.

    sql
    ALTER LOGIN app_svc WITH PASSWORD = N'<new-password>' UNLOCK;
    ALTER LOGIN app_svc WITH CHECK_EXPIRATION = OFF;

← Back to index