Skip to content

How to reset admin password in Magento 2

Complex passwords are the best way to secure your Magento admin. If you forget the passwords, it is hard to retain them, and you might lose the ability to manage the store. Fortunately, there are two methods to reset your password. The one seems easy, and the other complicated one is used when in deadlock!

Email Admin Password Recovery in Magento 2

Being the same as a user but with different rights, the Admin password can be recovered with the help of the default recovery system. It can be done via the “Forgot Password?” link on the admin log-in page. Click on the link, fill in your admin account's email address, and click on the "Retrieve Password."

You will receive an email with the link to reset the password.

Change Admin Password with phpMyAdmin

In the second method, you can reset the password directly in the Magento 2 database using phpMyAdmin. To do so, log in to cPanel if you have installed one. Go to the "Databases" section, and select the phpMyAdmin link.

Change Admin Password with phpMyAdmin

Change Admin Password with phpMyAdmin

Next, choose the Magento database from the left phpMyAdmin panel. Typically, the Magento database is called username_mageXXX. Username reflects your cPanel username, whereas XXX is three digits.

Once you get the list of tables, click on the “SQL” option from the top menu bar, copy the following line into the SQL query box, and replace the NEWPASSWORD with your latest one.

SQL query box

SQL query box

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1') WHERE username = ‘admin';

Each XXXXXXXX sequence should be replaced with any random characters.

Now, you must choose the" Go" button to accept and apply the changes and update the database.

This is how Magento 2 Admin can reset the password using these two solutions. Or never miss out on mistakes; why set the passwords with complex characters by installing Password Hide/Show.


Last update: 2022-06-20