How to Unlock Magento 2 Admin User Account?

Unlocking a Magento 2 admin user account can be done through the command line using the Magento Command Line Interface (CLI). To unlock an admin user account in Magento 2, follow these steps:

Note: You need SSH access to your server and administrative permissions to execute these commands.

  1. Connect to your server: Use SSH to connect to your Magento 2 server.

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

  3. Unlock the admin user account: Run the following command to unlock the admin user account. Replace admin_username with the username of the admin account you want to unlock.

bin/magento admin:user:unlock admin_username

For example, if your admin username is "admin," you would run:

bin/magento admin:user:unlock admin
  • Clear the cache (optional): It's a good practice to clear the Magento cache after making changes to the admin user account. Run the following command to clear the cache:
bin/magento cache:flush
  • Log in to the Magento admin panel: You should now be able to log in to the Magento admin panel using the previously locked admin user account.

That's it! The admin user account should now be unlocked, and you can access the Magento admin panel again.

Please make sure to replace admin_username with the actual username of the admin account you want to unlock. Additionally, ensure that you have the necessary permissions to execute these commands on your Magento server.