// SQL Server error reference

SQL Server error 18487: Login failed, password expired

The SQL login's password has expired under the server's Windows password policy. Set a new password to let it connect again.

Error number
18487
Severity
14
Category
Connection and login
Error message
Login failed for user '%.*ls'. Reason: The password of the account has expired.%.*ls

What it means

SQL logins created with CHECK_EXPIRATION = ON follow the server's Windows password expiration policy. When the password is older than the maximum password age, SQL Server rejects the login until a new password is set.

Common causes

  • The login was created with CHECK_EXPIRATION = ON and the password reached the maximum age set in the Windows password policy.
  • A service account login nobody rotates was given an expiring password.

How to fix it

  1. Set a new password as an administrator.

    ALTER LOGIN app_user WITH PASSWORD = N'<new strong password>';
  2. For a service account whose password you rotate yourself, turn expiration off (password policy still applies).

    ALTER LOGIN app_user WITH CHECK_EXPIRATION = OFF;
  3. See how close other logins are to expiring.

    SELECT name, LOGINPROPERTY(name, 'DaysUntilExpiration') AS days_left
    FROM sys.sql_logins WHERE is_expiration_checked = 1;

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.