For some X or Y reason, the Magento 2 Administrator password reset process may not work. In this case, you have many other possibilities that you can try. In today’s article, we will discuss four different approaches to reset the Magento 2 Admins password. Whether you’re a developer or a store, you don’t have to stay off your dashboard Magento. By the end of the article, you will understand how to use the standard procedure (reset the email link) or reset the database.
Where do you need this item?
There are many scenarios in which the current article can help. Here are a few :
- You don’t know how to reset your password, and you want to understand how to do it. It is beneficial for newbie store owners who are just getting started with Magento 2. 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 do not work properly, so 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 go to your dashboard and take control of your website.
Either way, you can try any of the suggestions below to get to your dashboard.
Different approaches to reset the Magento 2 Admin password.
You can 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:
- Log in to your Magento dashboard,
- Go to the System tab → Authorizations -> All the 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 on “Save user.”
Use the dashboard login page to reset a password. (2)
Another way to reset a Magento 2 administrator password is to go to the administrator login page. In this case, you can follow the steps below.
- Go to the login page on your dashboard 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.
- In some cases, Magento does not send the reset link due to the 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 do not 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 right from your database. Here is how to do it.
Step 1 – Obtain the cryptographic key.
- Connect to the 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';
- 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 that your cryptographic key is d10075ee37ff3f6dddssdlldac352773a029, you will run your MySQL query with it and have something like the example below.
- Finally, my username 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, all three of the above methods would work. You may not have a second administrator, the mail system is not working, and you do not have access to PhpMyAdmin. If so, the command line will help. In this case, the approach will create a new administrator login that you can use to access the dashboard. Once you’re 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
php bin/magento admin:user:create
It will ask you to provide a username, password, email address, last name and first name.
After providing all of 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.
The procedure for resetting a Magento 2 Admins password is not always easy. However, if you can use one of the methods given, you can try another.
Thank you for taking the time to read our article. If you like the article, you may also be interested in “6 Different Approaches to Resetting a WordPress Password”.