# Resetting the Drupal administrator password

> Regain access to Drupal by resetting the administrator password with phpMyAdmin, Drush or the MySQL command line.

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

If you forget your Drupal administrator password, you can reset it directly in the database. On **ruachost.com**, this is done through **phpMyAdmin** or the MySQL command line.

## Why Reset the Admin Password?

- Regain access to your Drupal site if locked out.
- Resolve login issues caused by corrupted credentials.
- Maintain site security by updating compromised accounts.

## Steps to Reset the Admin Password

### Method 1: Using phpMyAdmin

1. Log in to your **ruachost.com Client Area**.
2. Open **phpMyAdmin**.
3. Select your Drupal database.
4. Click the **users** table (usually named `users_field_data`).
5. Locate the administrator account (typically `uid = 1`).
6. Click **Edit**.
7. In the **pass** field, enter a new password using MD5 encryption:

   ```
   MD5(newpassword)
   ```

   *(Replace* `newpassword` *with your desired password.)*
8. Save changes.
9. Log in to Drupal with the new password.

### Method 2: Using Drush

If Drush is installed, you can reset the password via command line:

```bash
drush user-password admin --password="newpassword"
```

- Replace `admin` with your administrator username.
- Replace `newpassword` with your desired password.

### Method 3: Using MySQL Command Line

1. Log in to your server via **SSH**.
2. Access MySQL:

   ```bash
   mysql -u username -p
   ```
3. Select your Drupal database:

   ```
   USE drupal_database;
   ```
4. Update the password:

   ```
   UPDATE users_field_data SET pass = MD5('newpassword') WHERE uid = 1;
   ```
5. Exit MySQL and log in with the new password.

## Important Notes

- Always use a **strong password** to protect your site.
- If you use Drupal 8 or 9, passwords are hashed differently; Drush is the recommended method.
- Back up your database before making changes.
