Get Appointment

We have received your message and will contact you soon.

Thank you for choosing prositeweb, your web development agency in Montreal. Please call us at +1 (514) 548-2165 if you need immediate support.

Here are 4 different approaches to reset Magento 2 admin password

For some reason X or Y, the Magento 2 Admin password reset process may not work. In this case, you have many other possibilities that you can try. In today's article, we are going to discuss four different approaches to reset a Magento 2 Admins password. Whether you are a developer or a store, you don't have to stay out of your Magento dashboard. At the end of the article, you will understand how to use the standard procedure (email reset link) or database reset.

Where do you need this item?

There are many scenarios in which the current article can be useful. Here are a few :

  • You don't know how to reset your password and you want to understand how to do it. It is especially useful for newbie store owners who have just started with Magento 2. So, by following the steps, you will have a better idea of what to do if you can't remember your password.
  • Your email system is not working and you are not receiving the reset link. There may be times when your server's mail systems are not working properly, and therefore when you try to reset your password, you do not receive an email. In this case, it is better to use a database.
  • Your developer has left and denied you access to your website. You need to access your dashboard and take control of your website.

Either way, you can try one of the suggestions below to get to your dashboard.

Different Approaches to Reset Magento 2 Admin Password.

You may have more than four approaches, but trying one of the suggestions below may help.

Use another Admin Dashboard to reset a password. (1)

If your Magento 2 website has more than one admin, you can use the other admin password to reset your password. In this case, you can ask the second administrator to log in and help you with the procedure. Here are the steps to follow:

  • Login to your Magento dashboard,
  • Go to System tab -> Permissions -> All Users,
  • In the list of users, select the user whose password you want to reset,
  • Then add the new password and confirm the password,
  • At the bottom of the form, enter your password,
  • Then click "Register User".

    Use the dashboard login page to reset a password. (2)

Another way to reset a Magento 2 admin password is to go to the admin login page. In this case, you can follow the steps below.

  • Go to your dashboard login page and click on the "Forgot password" link.
  • A form will appear with a field to add the email address.
  • Enter your email address and click "Recover Password".
  • Magento will send you a reset link to your email address.

Remarks :

  • In some cases, Magento fails to send the reset link due to an email system issue. If this is the case for you, you can try the other methods to access your dashboard.
  • When it happens that you don't know your dashboard url, you can check your env.php file app/etc/
 'backend' => 
array (
'frontName' => 'adminccldd', 
),

If "adminccldd" is your dashboard bar, then you will have something like "https://yourURL.com/adminccldd".

Reset a Magento 2 Admin password directly from the database (3)

If you can't get the reset link in your email or if you don't have more than two admins on your site, you can do it directly from your database. Here's how.

Step 1 – Obtain the cryptographic key.

  • Connect to Magento 2 installation folder,
  • go to app/etc/env.php,
  • Copy the cryptographic key under "crypt".

The key looks like this:

 'crypt' => 
array (
'key' => 'd10075ee37ff3f6dddssdlldac352773a029',
),

Step 2 – Running the MySQL Query in PHPMyAdmin

 UPDATE prefix_admin_user SET password = CONCAT(SHA2('keyNewPassword', 256), ':key:1') WHERE username = 'myusername';

Remarks

  • Replace the prefix with the prefix of your Magento 2 database tables. For example, if your prefix is mag2, you will have mag2,_admin_user.
  • Replace "key" with your cryptographic key. If we assume your cryptographic key is d10075ee37ff3f6dddssdlldac352773a029, then you would run your MySQL query with it and get something like the example below.
  • Finally, my user name is your username.
 UPDATE mag2_admin_user SET password = CONCAT(SHA2('d10075ee37ff3f6dddssdlldac352773a029NewPassword', 256), ':d10075ee37ff3f6dddssdlldac352773a029:1') WHERE username = 'myusername';

Use the command line interface (4)

In most cases, the above three methods would work. It may happen that you do not have a second administrator, the mail system does not work and you do not have access to PhpMyAdmin. If so, the command line will help you. In this case, the approach will be to create a new admin login that you can use to access the dashboard. Once you are in your dashboard, you can either reset your password or delete the previous user. Here are the steps you need to follow:

  • Open your command line,
  • Navigate to the main directory of your Magento installation
  • type the following command

You will have something like this:

 admin admin:user:create Creates an administrator admin:user:unlock Unlock Admin Account

then type

 php bin/magento admin:user:create

It will ask you to provide username, password, email address, first and last name. After providing all this information, clear the cache.

 php bin/magento cache:flush

If you follow all the steps, you will be able to log into your Magento 2 dashboard as an administrator.

Conclusion

The procedure for resetting a Magento 2 Admins password is not always easy. However, if you can use one of the suggested methods, you can try another. Thanks for taking the time to read our article, if you like the article, you may also be interested in "6 Different Approaches to Reset WordPress Password" . Contact us if you have any questions. Message us to get your free quote for any Magento development or website development service.

Share :

npgilblas

How to transfer your physical store online (Create an eCommerce site)
01 February 2023
Add the PayPal payment form to any page of your website in minutes
30 March 2021

Do you have a project in mind? Contact our web agency for a free evaluation.

We are the experts in creating websites, online stores and functionalities for websites based in Montreal. Contact us today to create your website starting at $1,200.