Best Ways to Reset Admin Password in Magento 2

How to reset admin password in magento 2

Username and password are the required fields for login To the Magento admin panel. If you forget one of them, it’s a big hassle. Therefore, it is essential to learn how to reset your password for any store.

If your Magento admin account is locked, a Magento password reset tutorial will help you resolve the issue. Let’s do the following steps toreset your admin panel password in Magento 2.

Related posts: What is a Magento Extension?

Password reset tutorial in Magento 2

There are 4 ways to reset your Magento 2 password as follows:

  1. Solution 1: Reset Magento 2 admin password in Php MyAdmin.
  2. Solution 2: Reset your Magento password from the admin panel.
  3. Solution 3: Reset Magento 2 admin password via command line (Command Line).
  4. Solution 4: Reset Magento 2 admin password via email.

Solution 1: Reset Magento 2 admin password in PHP MyAdmin

Go to PHP myadmin and copy the following query commands:

UPDATE admin_user SET password = CONCAT (SHA2 (‘xxxxxxxYourNewPassword’, 256), ‘: xxxxxxx: 1’) WHERE username = ‘admin’;

Xxxxxxx characters are an encrypted code stored in APP/ etc / env.Php.

<? Php

return array (

‘Crypt’ =>

array (

‘Key’ => ‘525701df74e6cba74d5e9a1bb3d935ad’, // cryptographic salt


Solution 2: Reset your Magento 2 admin password from the Admin panel

Best Ways to Reset Admin Password in Magento 2
Best Ways to Reset Admin Password in Magento 2

If you have forgotten your password, click Forgot Your Password in the admin panel where you enter your password and username.

On the page that opens, enter the email address associated with the Admin account.

Click on Password Recovery. If there is an account associated with the email address, an email will be sent to that email to reset your password.

The sent email may be moved to your spam folder, so if the email is not in your inbox, see the Spam Email section.

Solution 3: Reset the Magento 2 password via the command line (CLI) or the same command line

In the Magento root folder, enter the following 2 commands.

Php bin / Magento –h

The result of the command line is as follows:


admin: user: create      Creates an administrator

admin: user: unlock    Unlock Admin Account

Magento 2 does not support password reset via the command line. However, we can create a new account, then use this new account to reset the old account.

Solution 4: Reset Magento 2 password via email

  • Go to the Magento admin panel which is by default.
  • Click Forgot your password.
  • Type the email address you registered with that corresponds to your account in the Email Address box
  • Click Retrieve Password to reset your password.

After doing this and sending the password to forget email, go to your inbox and find this email. This link is valid for 24 hours.

These were the best ways to reset your password in Magento 2. and the following are some questions that may ask yourself.

How do I reset my Magento 2 password?

These are 2 easy ways without coding to reset your Magento password:
1. If you forget your password; you can click on Forgot Your Password link on the login page. After that in the next step enter the Email Address that is related to your Magento account. To reset the password a temporary password will be sent to the email address immediately.

Now click on the reset password link that you got on your email and enter your new password. In the next box, you need to repeat your new password to confirm. Now your password is updated and you can use it to log in Magento Admin Panel.

2. If you don’t forget your Magento password but want to change it, do the following:
log in Admin Panel > navigate to system > all users> click on your account name > in the open section enter the new password and confirm it and at the end enter your current password then click on the Save User button.

As you know user name and password are the requirements to log in to a site and may you forget your password or need to update your user and password to prevent hackers sometimes.
In this article, we referred to the best ways to reset the admin password in Magento 2. We hope you can solve your problem by using these ways.