i have tried to reset password from mysql cli. myqueri is for that UPDATE admin_user SET password = CONCAT(SHA2('12345678admin', 256), ':12345678:1') WHERE username = '*****'

  • after update password i am not able to login admin backend in magento2 Oct 3, 2019 at 9:30
  • Please respond to the comments in the right place :))
    – MichaelHa
    Oct 3, 2019 at 9:39

5 Answers 5


Step 1: SQL query

NewPassword with the new password, and replace both occurrences of xxxxxxxx with any random character sequence:

UPDATE admin_user SET `password` = CONCAT(SHA2('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1') WHERE `username` = 'admin';

reference link: https://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/magento1/resetting-the-magento-administrator-password

Step 2:

You can use Magento CLI to create new admin user with the following command, then you can go and change password of your original user.

<path_to_magento>/bin/magento admin:user:create --admin-user="admin" --admin-password="123123q" --admin-email="[email protected]" --admin-firstname="Admin" --admin-lastname="Admin"

reference link: How to reset lost admin password in Magento 2?

Hope this will help you.

  • 1
    +1 upvoted for the explanation in the step 1. I was confused about xxxxxx.. and the solution 1 worked for me :) Sep 15, 2020 at 6:00

You can add a new user if you don't remember your password

php bin/magento admin:user:create --admin-user="your_name" --admin-password="your_pass" --admin-email="your_email" --admin-firstname="first_name" --admin-lastname="last_name"


  • Why you thanked? :) Oct 3, 2019 at 12:29

Magento 2 does not support reset password via command line cli. However, we can create a new admin account by cli, then use the new account to reset the old one. or update by phpmyadmin database direct query:

UPDATE admin_user SET `password` = CONCAT(SHA2('xxxxxxxxNewPassword', 256), ':xxxxxxxx:1') WHERE `username` = 'admin';

Magento supports out of the box password change via CLI. You should use the command to create an admin user, but enter details of existing user bin/magento admin:user:create

Then you should enter a new admin password. Pay attention. The email you enter should be the same as in the database, otherwise, you'll catch an exception.


Magento 2 doesn't support this out of the box. You can however download n98-magerun for magento 2.

Once installed, you will have a few new Magento CLI commands. One of these new commands will let you change the password for your admin user.

n98-magerun2.phar admin:user:change-password username password

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.