How to Reset Magento Admin Password from Database

Hello everyone… Happy meet again after too long time I posted the article in 

OK, in this momen I will share my bad experience that had lost my admin passwordforgot-password.

Actually, in magento we able to reset our password by forgot password feature. System will send us an email of reset password link automatically after we input registered email.

But how if your environment didn’t have an email services or internet connection (eg: isolated local system)? we wouldn’t get any reset email from system. So, we should reset password from Database.

By this article, I will give trick to reset magento admin password for Magento 1.x and Magento 2.x

1. Find your Database

We must to make sure which one DB we will run the querry.

  • in Magento 1.X we will found it in app/etc/local.xml
  • in magento 2.x we can open it in app/etc/env.php

2. Run the querry

Select the corresponding database from the drop-down menu on the left side. After that click on the SQL tab in order to be able to execute the following MySQL query. Note that the query will differ depending on the Magento version you have:

  • Magento 1.9 and older:

  • Magento 2:

Make sure that you substitute the following variables:

admin_user – this is database table from the Magento database. Bear in mind that this table may have a prefix such as “mg_” or a different one. You will see the prefix of the database (if any) once you access the phpMyAdmin tool and select the the Magento database. If there is a prefix you should replace the admin_user name with the correct database table name, e.g. mg_admin_user.

YOUR_NEW_PASSWORD – the desired password which you want to be set. The xx..xx character sequence is a cryptographic salt. It can be anything you want, but make sure you use the same value in both parts of the SQL statement.

YOUR_ADMIN_USERNAME – your Magento administrative username, i.e. admin.

xxxxxxxx – the secret key generated for your Magento installation. The key can be obtained from the configuration file of the application, mentioned at the beginning of this article.

Execute the query and your new Magento password will be set.