// SQL Server error reference

SQL Server error 18486: Login failed, account locked out

A SQL login was locked after too many failed password attempts under the Windows account lockout policy. An administrator has to unlock it.

Error number
18486
Severity
14
Category
Connection and login
Error message
Login failed for user '%.*ls' because the account is currently locked out. The system administrator can unlock it. %.*ls

What it means

SQL logins created with CHECK_POLICY = ON follow the Windows password policy of the server, including account lockout. After the configured number of bad passwords, the login is locked and refuses every attempt, even with the right password, until it is unlocked or the lockout duration passes.

Common causes

  • An application or service kept retrying with an old password after the password was changed.
  • Someone mistyped the password repeatedly.
  • A brute-force attempt against the login.

How to fix it

  1. Check whether the login is locked.

    SELECT LOGINPROPERTY(N'app_user', 'IsLocked') AS is_locked,
           LOGINPROPERTY(N'app_user', 'BadPasswordCount') AS bad_password_count;
  2. Unlock it. UNLOCK has to be combined with setting a password.

    ALTER LOGIN app_user WITH PASSWORD = N'<password>' UNLOCK;
  3. Find and fix whatever was sending the wrong password (old connection strings, scheduled jobs, linked servers), or it will lock again.

Related errors

More connection and login errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.