Tatvam Infotech Blog Banner

How to Unlock Admin User in Magento 2

Introduction: 

In Magento 2, if you find yourself locked out of the admin panel due to multiple failed login attempts, you might need to unlock your admin user account. In this tutorial, we'll show you how to unlock the admin user in Magento 2 using a command line.

Command Line Steps: To unlock the admin user in Magento 2, you can use the command line. Follow these steps:

SSH into Your Server: Log in to your server via SSH.

Navigate to the Magento Root Directory: Use the cd command to navigate to your Magento 2 root directory.

Run the Unlock Command: Use the following command to unlock the admin user:

 

bin/magento admin:user:unlock <USERNAME>

Replace <USERNAME> with the username of the admin user you want to unlock.

Clear Cache: After running the unlock command, it's a good practice to clear the cache for changes to take effect. You can do this using:

 

bin/magento cache:clean

Example: Let's say your admin username is "adminuser." To unlock this admin user, you would run the following command:

 

bin/magento admin:user:unlock adminuser

This will unlock the specified admin user, allowing you to log in to the Magento 2 admin panel again.

Conclusion: Unlocking the admin user in Magento 2 using the command line is a quick and efficient way to regain access to your admin panel if you've been locked out due to multiple login failures. Follow the steps mentioned above, and you'll be back in control of your Magento 2 store.