How To Reset Admin Password in Magento

You can reset your Magento administrative password directly through the database used by your website application.

If you are not sure which database is related to your website you can find its name inside the Magento database configuration file:

  • Magento 1.9 and older:

app/etc/local.xml

  • Magento 2:

app/etc/env.php

You can open the configuration file using File Manager in cPanel and search for the dbname line where you will find the database name.

The next step is to access the database of your website through phpMyAdmin in cPanel.

Select the corresponding database from the dropdown 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.

You find this article useful? Click here to learn more about SiteGround web hosting experts and what else we can do for you!