# Resetting the Magento administrator password

> Get back into your Magento admin account by resetting the password by email or by updating the database in phpMyAdmin.

Source: https://helpcenter.ruachost.com/apps/magento/resetting-the-magento-administrator-password/

If you forget your Magento administrator password and cannot log in, you can reset it either through the **email recovery feature** or by manually updating the database. On **ruachost.com**, both Magento 2 and Magento 1.9 (and older) support these methods.

## Method 1: Reset via Email (Recommended)

1. Go to your Magento **Admin Login Page**.
2. Click **Forgot your password?**.
3. Enter the **email address** associated with your admin account.
4. Click **Retrieve Password**.
5. Magento will send a reset link to your email.
6. Click the link and set a new password.

✅ This is the quickest and safest method if email is working correctly.

## Method 2: Reset via Database (phpMyAdmin)

If email recovery is unavailable (e.g., email not configured properly), you can reset the password directly in the database.

### Magento 2

1. Log in to **cPanel** or your Client Area.
2. Open **phpMyAdmin**.
3. Select your Magento database (usually named `username_mageXXX`).
4. Click the **SQL** tab.
5. Run the following query (replace `NewPassword` with your new password and `xxxxxxxx` with a random salt string):

   ```
   UPDATE admin_user
   SET `password` = CONCAT(SHA2('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1')
   WHERE `username` = 'admin';
   ```
6. Click **Go**.
7. Log in to Magento with your new password.

### Magento 1.9 and Older

1. Log in to **cPanel** or your Client Area.
2. Open **phpMyAdmin**.
3. Select your Magento database.
4. Click the **SQL** tab.
5. Run the following query (replace `NewPassword` with your new password and `xx` with a random two‑character salt):

   ```
   UPDATE admin_user
   SET `password` = CONCAT(MD5('xxNewPassword'), ':xx')
   WHERE `username` = 'admin';
   ```
6. Click **Go**.
7. Log in to Magento with your new password.

##

## Important Notes

- Always back up your database before running SQL queries.
- Replace `admin` in the query if your administrator username is different.
- Use a strong password (mix of uppercase, lowercase, numbers, and symbols).
- If your Magento installation uses table prefixes, add them to the table name (e.g., `mg_admin_user`).
