How to Reset the Admin Password on Magento 2

how to reset the admin password on magento 2

We’ll guide you on how to reset your Magento 2 admin password. Magento 2 is a robust and open-source e-commerce platform written in PHP and utilizes MySQL for database management, providing a powerful foundation for creating impressive online stores. As of 2017, Magento 2 has gained popularity and is employed by a significant portion of the internet.

Magento 2 administrators may find the need to alter their dashboard password, either due to forgetting the current one or desiring to enhance security with a new, stronger password. While the “Lost your password?” option on the Magento 2 login form is a straightforward method for password reset, there are instances where this approach may not be feasible, especially if an admin has lost access to their email.

This tutorial will comprehensively explore various methods for resetting your Magento 2 administrator password.

Method 1. Change Magento 2 Admin Password via Magento Backend

One of the simplest and most convenient methods is resetting the password for your Magento 2 server directly within the Admin panel.

If you happen to forget your password, simply click on the “Forgot Your Password?” link.

Follow these steps to reset the admin password in Magento 2:

  • Provide the Email Address linked to the Admin account.
  • Click on “Retrieve Password.” If an account is associated with the provided email address, an email will be sent to facilitate the password reset. To avoid emails being marked as spam, consider enabling SMTP settings.

Method 2. Change the Password via phpMyAdmin:

At times, accessing your dashboard may be challenging due to reasons like password forgetfulness or a compromised site. However, there’s no need to worry because you can reset the password through phpMyAdmin, a graphical utility tool designed for MySQL database management.

After logging in to phpMyAdmin, navigate to your Magento database in the left-side list. The database tables are listed there, which you can see in the image below:

Find the table that contains the admin user information. This table normally has the name admin_user, but it may have a prefix based on your Magento installation.

Look for the row corresponding to the Magento admin user whose password you want to change. The username is typically admin. Double-click on the password column and copy the value of your cryptographic key. This is the value found between the ‘:’ symbols.

Now, click on the SQL button on the top menu and run the following query:

UPDATE admin_user SET password = CONCAT(SHA2('xCryptKeyxYourN3wPassw0rd', 256), ':xCryptKeyx:1') WHERE username = 'YourAdminUser';

Important: Please update xCryptKeyx with your cryptographic key, and YourN3wPassw0rd with your new password. Additionally, replace YourAdminUser with the username for which you are resetting the password.

Save the changes by clicking the “Go” or “Save” button at the bottom of the page.

Please take caution whenever you directly modify the database. We also recommend taking a backup before making any changes. Additionally, it’s crucial to comply with security best practices and ensure the confidentiality of passwords.

Method 3. Reset Magento 2 Admin Password via Command Line Interface (cli)

To reset the Magento 2 admin password via the command line interface (CLI), you can use the bin/magento command-line tool provided by Magento. Follow these steps:

First, access the command line or terminal on your server or local development environment.

Next, navigate to the Magento 2 installation directory using the following command:

cd /path/to/your/magento2

Then, run the following command to reset the admin password:

bin/magento admin:user:create --admin-user=YourAdminUser --admin-password=YourN3wPassw0rd

Replace “YourAdminUser” with your actual admin username and “YourN3wPassw0rd” with the new password you want to set.

Next, input your email, first name, and last name.

After changing the password, it’s a good practice to flush the Magento cache:

bin/magento cache:flush

This command is designed for creating a new user. However, if the user already exists, it updates the admin user’s password directly in the database. It is a secure method for resetting the password without exposing sensitive information.

Method 4. Reset Magento 2 Admin Password via Account Settings

This method allows you to reset the admin password without using the command line or accessing the database directly. It’s a user-friendly approach available within the Magento 2 Admin Panel, making it convenient for administrators to manage their account security.

Please note, to use this method you need to know your current password.

First, open your web browser and navigate to the Magento 2 Admin Panel.

Once logged in, click on your account name or profile picture in the top right corner of the admin panel. This will open a dropdown menu.

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS

In the dropdown menu, click on “Account Setting”

You will be prompted to enter your current password and the new password you want to set. Ensure that the new password meets any security requirements specified by your Magento 2 installation.

After entering the required information, click on the “Save Account” button to save the changes.

For security reasons, log out of the admin panel and log back in using the new password to confirm that the password change was successful.

You can now log in to the Magento 2 admin panel using the new password. For additional details about Magento 2, its features, and configuration, refer to their official documentation.

Of course, you don’t have to change your Magento 2 admin password if you use one of our Magento Hosting services, in which case you can simply ask our expert Linux admins to reset the Magento 2 admin password for you. They are available 24×7 and will take care of your request immediately.

If you liked this post on resetting Magento 2 admin password, please share it with your friends if they’re having trouble with their accounts. If you know of another way to reset the admin password, you can leave a comment below. Thanks for reading.

Leave a Comment