> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-4100-to-4199/e4151.md).

# Error 4151: Access denied, this account is locked

| Error Code | SQLSTATE | Error                          | Description                           |
| ---------- | -------- | ------------------------------ | ------------------------------------- |
| 4151       |          | ER\_ACCOUNT\_HAS\_BEEN\_LOCKED | Access denied, this account is locked |

## Possible Causes and Solutions

The account is [locked](/docs/server/security/user-account-management/account-locking.md), with `CREATE USER … ACCOUNT LOCK` or `ALTER USER … ACCOUNT LOCK`. The server refuses new connections for the account. Sessions that were open when the account was locked aren't affected.

The server checks the lock only after the password is accepted. With a wrong password, a locked account gets [error 1045](/docs/server/reference/error-codes/mariadb-error-codes-1000-to-1099/e1045.md), so this error also confirms that the password was right.

To solve the error, an administrator unlocks the account:

```sql
ALTER USER 'app'@'localhost' ACCOUNT UNLOCK;
```

To check whether an account is locked, use [SHOW CREATE USER](/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-user.md), which shows `ACCOUNT LOCK` for a locked account.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
