How to change Magento 2 Admin password?

To reset the password for the Magento administrator account, you can follow these steps:

  1. Go to the Magento website’s login page.
  2. Click on the “Forgot Your Password?” link.
  3. Enter the email address associated with the administrator account.
  4. Click the “Retrieve Password” button.
  5. Magento will send an email to the address with instructions on how to reset the password.
  6. Follow the instructions in the email to reset the password.

Note: If you don’t have access to the email address associated with the administrator account, you can reset the password directly in the database. To do this, you will need access to the server where the Magento installation is located and to the database that is used by Magento.

  1. Connect to the server using SSH.
  2. Use the MySQL client to connect to the Magento database.
  3. Run the following SQL query to reset the password:
UPDATE admin_user SET password=CONCAT(SHA2('passwordSalt', 256), ':password:password') WHERE username='admin';

Replace password with the new password you want to use.

  1. Exit the MySQL client and log in to the Magento admin panel using the new password.

Change Magento 2 Admin Password through phpMyAdmin

To change the Magento 2 administrator password through phpMyAdmin, you can follow these steps:

  1. Log in to phpMyAdmin.
  2. Select the database used by your Magento installation.
  3. Go to the admin_user table.
  4. Find the record with the username admin.
  5. Click on the Edit button.
  6. Scroll down to the password field.
  7. Replace the current password hash with a new one. You can use a tool like Magento 2 Password Hash Generator to generate a new hash.
  8. Click on the Go button to save the changes.

After following these steps, you should be able to log in to the Magento 2 administrator panel using the new password.

To reset the Magento administrator password through the terminal, you can use the following steps:

  1. Connect to the server using SSH.
  2. Change to the Magento installation directory.
  3. Run the following command to reset the password:
php bin/magento admin:user:create --admin-user=admin --admin-password=password [email protected] --admin-firstname=Firstname --admin-lastname=Lastname
Replace password with the new password you want to use and [email protected] with the email address associated with the administrator account.
  1. Log in to the Magento admin panel using the new password.

Note: This command will create a new administrator account with the specified username, password, email, first name, and last name. If the admin account already exists, this command will update its password, email, first name, and last name.

If you are using different php version than default server version, point the php directory.

/www/server/php/74/bin/php bin/magento admin:user:create --admin-user='example' --admin-password='example' --admin-email='[email protected]' --admin-firstname='admin_user_first_name' --admin-lastname='admin_user_last_name'