Magento 2 How to Unlock Admin User via Command Line

In this tutorial, we will talk about How to Unlock Admin User via Command Line. As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this, let me explain more detail about How to Unlock Admin User via Command Line.

How to Unlock Admin User via Command Line

Go to Magento admin root folder and show usage:

php bin/magento admin:user:unlock --help
  admin:user:unlock <username>

  username              The admin username to unlock

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  This command unlocks an admin account by its username.
  To unlock:
        bin/magento admin:user:unlock username

Syntax to Unlock Admin user

php bin/magento admin:user:unlock username

Let unlock a admin account: mageplaza with the following information

Type in the command line:

php bin/magento admin:user:unlock mageplaza


The user account "mageplaza" has been unlocked


If the admin user was not locked, you may get this message:

The user account "mageplaza" was not locked or could not be unlocked

Now to go to admin login page, and fill the above information

magento 2 login

and I’m in now, see this screenshot

magento 2 admin pannel

Enjoyed the tutorial? Spread it to your friends!


Sam Thomas
Sam Thomas

Sam is the CEO and Founder of Mageplaza, pursuing a simple and healthy lifestyle. He is a friend, a husband, and a father to two children. As a trainer and an aspiring influencer, he is also a big fan of sports and travel. Sam is exceptionally knowledgeable about e-commerce, especially Magento and Shopify, with 10 years of experience in the field.