When attempting to connect to a SQL data source, you may encounter the following error message: (0x80131904): Login failed for user 'UserX'.
This typically indicates that the account has been locked after multiple unsuccessful login attempts. Whether this occurs depends on the SQL Server’s configured password policy.
To confirm whether the SQL account is locked, run the following query:
SELECT LOGINPROPERTY('UserX','islocked')
A result of 1 means the account is locked.
You can unlock the user account in one of two ways:
To manually unlock the user, open the user’s properties, navigate to the Status tab, and uncheck Lock SQL user. Then, update the password as needed and apply the changes.
Alternatively, run the following SQL command to unlock the account and reset the password:
ALTER LOGIN [SQLID] WITH PASSWORD = 'NewSecurePasswordHere' UNLOCK
Replace 'NewSecurePasswordHere' with a strong password that meets your organization's security requirements.
To learn more, visit the official Microsoft SQL Server documentation.