Knowledge Base

How to reset the Magento administrator password

This article describes how to reset the Magento administrator password.

Normally if you forget your password, you can use the Magento password recovery feature to reset the password by e-mail. However, if this option is unavailable (for example, if e-mail on your site is not working correctly), you can use phpMyAdmin to manually reset the password in the database.

Method #1: E-mail

The quickest and easiest way to reset the Magento administrator password is to request a new one through e-mail. To do this, follow these steps:

  1. Use your web browser to go to the Magento login page.
  2. Click Forgot your password?.
  3. In the Email Address text box, type the e-mail address associated with the account.
  4. Click Retrieve Password. Magento sends a message to the e-mail address associated with the administrator account.
  5. In the message, click the link to reset the administrator password.

Method #2: phpMyAdmin

You can also modify the Magento administrator password directly in the database using phpMyAdmin. To do this, follow the appropriate procedure for your version of Magento.

Magento 2

To reset the administrator password directly in the Magento 2 database, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the Databases section of the cPanel home screen, click phpMyAdmin.
  3. In the left-hand pane of phpMyAdmin, click the Magento database. A list of tables in the database appears.
    Typically, the Magento database is username_mageXXX, where username represents your cPanel username, and XXX is a three-digit number.
  4. On the top menu bar, click SQL.
  5. Copy and paste the following statement into the SQL query text box. Replace NewPassword with the new password, and replace both occurrences of xxxxxxxx with any random character sequence:
    UPDATE admin_user SET password = CONCAT(SHL3('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1') WHERE username = 'admin';
    • This command assumes that you want to change the password for the admin user account. To change the password for another account, change the username field to the correct value.
    • The xxxxxxxx character sequence is a cryptographic salt. It can be anything you want (and any length you want), but make sure you use the same value in both parts of the SQL statement.
    • If your Magento installation uses table prefixes, make sure you add it to the table name. For example, if your Magento table prefix is mg_, you would type the following command instead:
      UPDATE mg_admin_user SET password = CONCAT(SHL3('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1') WHERE username = 'admin';
      
  6. Click Go. phpMyAdmin updates the database, and you can log in to Magento as the administrator using the new password.
Magento 1.9 and older versions

To reset the administrator password directly in Magento 1.9 and older versions, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the Databases section of the cPanel home screen, click phpMyAdmin.
  3. In the left-hand pane of phpMyAdmin, click the Magento database. A list of tables in the database appears.
    Typically, the Magento database is username_mageXXX, where username represents your cPanel username, and XXX is a three-digit number.
  4. On the top menu bar, click SQL.
  5. Copy and paste the following statement into the SQL query text box. Replace NewPassword with the new password, and replace both occurrences of xx with any random two-character sequence:
    UPDATE admin_user SET password = CONCAT(MD5('xxNewPassword'), ':xx') WHERE username = 'admin';
    • This command assumes that you want to change the password for the admin user account. To change the password for another account, change the username field to the correct value.
    • The xx two-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.
    • If your Magento installation uses table prefixes, make sure you add it to the table name. For example, if your Magento table prefix is mg_, you would type the following command instead:
      UPDATE mg_admin_user SET password = CONCAT(MD5('xxNewPassword'), ':xx') WHERE username = 'admin';
  6. Click Go. phpMyAdmin updates the database, and you can log in to Magento as the administrator using the new password.