How to Reset Magento 2 Admin user password? - Kishan Savaliya

Welcome to Kishan Savaliya's Magento 2 Blog. In this blog post, we will learn how we can reset Magento 2 admin user password?

In Magento, if you want to access admin panel then username and password are required, and if you(store manager) forgot password then it may be difficult to login to the Magento store. So if you're new in Magento or if you don't know how to reset admin user password, then this article can be useful to you. In case, if you remember password but you want to change password for security reason, then you can do that also easily, I will describe that method as well in this tutorial.

You can change password by using various methods. Below is method list to reset Magento 2 admin user password..

List of method How to reset admin user password in Magento 2.

  1. Reset Magento 2 admin user password using Forgot your password? link of login page.
  2. Reset Magento 2 admin user password from backend system configuration.
  3. Reset Magento 2 admin user password via CLI command.
  4. Reset Magento 2 admin user password via MySQL query in CLI command.

So let's use one-by-one all methods..

1. Reset Magento 2 admin user password using Forgot your password? link of login page.

  • Open your admin panel (Backend) page.
  • Click on Forgot your password? link.
  • Enter your email address and if you have captcha enabled then add captcha letters and numbers from image and click on "Retrieve password" button.
  • You will get receive password email on your email. There you can click on reset password link and you can change your admin user password easily. This is easy way to reset password of admin user.

How to Reset Magento 2 Admin user password?

How to Reset Magento 2 Admin user password?


2. Reset Magento 2 admin user password from backend system configuration.

If you know your admin user password, but you want to change it for security reason, then you can follow below given steps and you can easily reset your admin user password.

  • Open you Magento 2 admin panel
  • Login with your Username and Password.
  • Go to Account settings.
  • Enter a New password.
  • Enter same password again in Password confirmation field.
  • Enter your Old Password to your identity confirmation.
  • Click on Save Account button.

That's it. This is also very easy because backend interface is quite simple to use and anyone can understand easily, and steps can be remember easily.

How to Reset Magento 2 Admin user password?


3. Reset Magento 2 admin user password via CLI command.

Run below command in your terminal to reset your password.

php bin/magento admin:user:create --admin-user=username --admin-password=new_password

Above command is useful to create new user, but you can change password of an existing user as well.

Whenever you will try to run above command, you need your account's correct email address. Without correct email address command will not allow you to reset your account password. So if you don't remember which email address you used for your account then you can not reset password using this method, you can try other methods in that case.

How to Reset Magento 2 Admin user password?

You can see in above image, I used wrong email for an existing user and it's not allow me to change email address with password, or if you forgot email address as well then this method will not be useful to you, In that case you can create new backend user with different username and different email address and then you can change password of current user with new account using Step - 2.


4. Reset Magento 2 admin user password via MySQL query in CLI command.

You can change password using MySQL query in your phpMyAdmin, In case if you're not able to access phpMyAdmin directly then you can use below command in your terminal and you can change password of you admin user.

echo "use magento2; UPDATE admin_user SET password = SHA2('admin1234', 256) WHERE username='admin';" | mysql -uroot -p

Here, I have used my database name magento2, you can set your database name there, as well as where I used root as my username, you can put your username of MySQL there.

If you can access phpMyAdmin, then you can follow below steps..

  • Open phpMyadmin
  • Select your Database
  • find admin_user table
  • You can run below MySQL query in SQL tab
    UPDATE admin_user SET password = SHA2('admin1234', 256) WHERE username='admin';

Hope you may like this article and can understand this easily. You can add comments below in case if you have any questions regarding this article or if I missed anything here. I will check and get back to you with proper solution.

If you enjoyed this blog post, share it with friends!