Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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, 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, so this error also confirms that the password was right.

To solve the error, an administrator unlocks the account:

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

To check whether an account is locked, use SHOW CREATE USER, which shows ACCOUNT LOCK for a locked account.

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?