Hello Magento Friends,
Today we are going to learn How to Reset Magento 2 Admin Password.
Having a strong password for any store or account is necessary to save your store from unauthorized access. And having a strong password for your admin panel is also one of the important things. Your password should be unique, and for others, it should be hard to know the trick.
But what happens when you forget that unique hard-to-follow password of your admin panel? You most certainly won’t be able to sign in to your admin account.
Therefore, today I am going to tell you all not to worry too much because we have got you covered. I have come up with a few ways you can use to reset your admin password. Below are the methods you can easily implement to retrieve the control of your admin panel.
Method-1: Reset Magento 2 Admin Password using Forgot Password
It is the most common and general method you can use to reset the password.
Step 1: Go to the Magento Admin login page.
Step 2: Click on Forgot password.
Step 3: Enter Email and click Recover Password.
Step 4: If cron is properly set up and Emails are working fine, then you will receive an email to reset the password for your admin user.
Method – 2: Reset Magento 2 Admin Password using Account Settings
You can even reset Magento 2 Admin Password from the Account Settings in the backend.
Step 1: Log in to Magento Admin Panel.
Step 2: Go to Account Setting as shown in the figure.
Step 3: Next, Enter the New Password.
Step 4: Enter the new password again in the Password Confirmation field.
Step 5: Enter your old password in the Your Password field.
Step 6: Then, click on Save Account.
Method- 3: Reset Magento 2 Admin Password using Database
Let’s assume that you don’t have access to your Email id, but you can access the database, then you need to follow this method.
Go to phpMyAdmin and copy the following SQL query:
UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxYourNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin';
Note: The xxxxxxx character sequence is a cryptographic salt, you can find it in the app\etc\env.php file.
See below:
<?php return array ( ... 'crypt' => array ( 'key' => '525701df74e6cba74d5e9a1bb3d935ad', //cryptographic salt ), … .. .
Method – 4: Reset Magento 2 Admin Password using Command Line (CLI)
Connect Your server with SSH – then go to Magento Root Folder and run the below command to create a new user,
bin/magento admin:user:create
It should ask you for some information like username, password, email, first name, and last name.
For Example:
Admin user: magecomp Admin password: Your Password Admin email: test.magecomp@gmail.com Admin first name: Magecomp Admin last name: Team
That’s it, and your new admin user with username magecomp is created.
You can also run the below command with all the information passing in one command string.
php bin/magento admin:user:create –admin-user=”gaurav” –admin-password=”gaurav123″ –admin-email=”admin@google.com” –admin-firstname=”Admin” –admin-lastname=”Admin”
Bonus Tip: In rare cases, if the admin user is locked out, then you can run the following command to unlock it.
php bin/magento admin:user:unlock admin-username
Conclusion:
Using any one of the above methods, you can reset your admin password and can save your Magento store from getting into the hands of fraudsters. So, this was all for today. I will be back again with new exciting Magneto news and tutorials. Till then, keep reading the Magento tutorial series.
If you liked this tutorial, then give it a thumbs-up and let us know what you liked the most in the comments. Also, please share this with your Magento colleague and friend to let them know.
Lastly, if you had any problem while implementing these methods or need any help with your Magento store, then you can contact our Support Desk. We will be happy to help you.
P.S. If you want me to write on a topic that you are facing a problem with your Magento then let me know in the comments, we will try our best to provide you with a workable solution.