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
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
-
Check whether the login is locked.
SELECT LOGINPROPERTY(N'app_user', 'IsLocked') AS is_locked, LOGINPROPERTY(N'app_user', 'BadPasswordCount') AS bad_password_count; -
Unlock it.
UNLOCKhas to be combined with setting a password.ALTER LOGIN app_user WITH PASSWORD = N'<password>' UNLOCK;
-
Find and fix whatever was sending the wrong password (old connection strings, scheduled jobs, linked servers), or it will lock again.
Related errors
18456Login failed for user18470Login failed, account disabled18487Login failed, password expired18488Login failed, password must be changed
More connection and login errors
53Network-related or instance-specific4060Cannot open database requested4064Cannot open user default database18452Login is from an untrusted domain18461Login failed, single user mode
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.
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.