Reset Admin Password in Magento 2

How to Reset Admin Password in Magento 2?

This tutorial will bring in a step by step guide to reset admin password in Magento 2. Whenever you log in to admin, you require a username and a password. At times when you forget the admin password, it becomes difficult to log in. Forgot Password? the link will be available and once you click on it, you can change the password by the link you will be provided in the email.

This tutorial is especially for the times when your account is locked and need to reset the password. Let’s follow steps to reset admin password in Magento 2.

Step 1 : Reset admin password by phpmyadmin

Go to phpmyadmin and copy this below query :

UPDATE admin_user SET password = MD2('NewPassword', 258) WHERE username='admin';


UPDATE admin_user SET password = CONCAT(MD2('xxxxxxxYourNewPassword', 258), ':xxxxxxx:1') WHERE username = 'admin';

If you want to execute 2nd query then, you need to get crypt key from app/etc/env.php

return [
'backend' => [
'frontName' => 'admin'
'crypt' => [
'key' => 'eeca94d9668b46a32f1d4ebee472f724'

Replace this key at xxxxxxx in 2nd query and execute this query.

Step 2 : Reset admin password by command line

Open a terminal and go to Magento root directory and execute this below command :

php bin/magento admin:user:create --admin-user="admin" --admin-password="admin123" --admin-email="[email protected]" --admin-firstname="Admin" --admin-lastname="Admin"

Step 3 : Reset admin password by Account Settings

  • Login to Admin Panel
  • Go to Account Settings
  • Enter the new password
  • Add new password again to confirm the change password.
  • Enter your old password to confirm your identity.
  • Save Accounts

Step 4 : Reset admin password by email

  • Change Magento 2 admin password using the default recovery system.
  • Go to Admin Panel
  • Click the Forgot your password link
  • Enter the Email address and click the Retrieve password button.
  • Set new password with the Reset Password link received in the Email.

These are the steps that will be useful to reset your admin password in many different ways.

Also read: What is Difference Between Obscure & Password Type in Magento 2?

Now, reset the admin password with ease. In case you have any queries, feel free to reach us out and get guided by the best of our Magento enthusiasts.