Cookies setting

Cookies help us enhance your experience on our site by storing information about your preferences and interactions. You can customize your cookie settings by choosing which cookies to allow. Please note that disabling certain cookies might impact the functionality and features of our services, such as personalized content and suggestions. Cookie Policy

Cookie Policy
Essential cookies

These cookies are strictly necessary for the site to work and may not be disabled.

Information
Always enabled
Advertising cookies

Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.

Information
Analytics cookies

Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.

Information
mageplaza.com

4 Ways to Reset Admin password in Magento 2

Vinh Jacker | 06-28-2024

Reset Admin Password Reset Admin Password

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

Username and Password are the required fields if you want to log in the Magento admin. And it is a huge problem if you forget one of them. Or in other cases, you need to change your password regularly for better protection. Therefore, resetting admin password is very essential to every store. With Magento 2, “Forgot your password” link is available to click, then a temporary password can be sent to the email address that is associated with the account immediately. If the admin account gets locked, this tutorial will help. Let do the following steps to reset your admin password in Magento 2.

To reset Magento 2 admin password

There are 4 ways to reset the admin password in Magento 2:

Solution 1: Reset Magento 2 admin password in phpmyadmin

In this solution, we are going to use phpmyadmin to change the admin password. Go to phpmyadmin and copy the following sql query:

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

The xxxxxxx character sequence is a cryptographic salt, it is saved in app\etc\env.php file

<?php
return array (
  ...
  'crypt' => 
  array (
    'key' => '525701df74e6cba74d5e9a1bb3d935ad', //cryptographic salt
  ),
  ...

Note: Replace the value of $PASSWORD with your new password, and substitute $USERNAME with the username for which you intend to reset the password for.

OR:

You may visit phpMyAdmin and execute the following query:

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

Solution 2: Reset your Magento 2 password from Admin panel

One of the most straightforward and easiest to do is resetting the password for your Magento 2 store right from the Admin panel.

  • If you forget your password, click the Forgot Your Password? link.

How to reset admin password Magento 2 Forgot Password

  • Enter the Email Address that is associated with the Admin account.
  • Click  Retrieve Password. If there is an account associated with the email address, an email will be sent to reset your password. To prevent email to spam box, enable SMTP here

Solution 3: Reset Magento 2 admin password via command line (cli)

Another method is using the command line. We typed on Magento 2 root folder:

php bin/magento -h

It show the admin command line:

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

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

magento 2 create admin user

Follow this guide to create a new admin account.

Solution 4: Reset Admin password in Magento 2 via Account Settings

This tactic can be used when you remember your current password but want to reset it for security.

  • Go to Magento Admin panel
  • Click on the Account Settings in the drop-down list of the account
  • Type the new password
  • Confirm the new password by retyping
  • Enter the old password for identity check
  • Select Save Account

The bottom line

Resetting your admin password in Magento 2 is easier than ever if you follow the above 4 solutions. Feel free to choose the way that suits you, and you are welcomed to comment your ideas or any concerns you are having in the comment box. And don’t forget to check the related topic below!

Related Topics:

Table of content
    Jacker

    With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.



    Related Post

    Website Support & Maintenance Services

    mageplaza services

    Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.