I have used the admin account one year before, now i have forgot the user credentials, then i run the following queries on the admin_user table in magneto2 db

UPDATE admin_user SET password = 'admin' WHERE username = 'admin'; 

and query was successful

and unlocked the account also using following -

php bin/magento admin:user:unlock admin

and got message that The user account "admin" has been unlocked

then i removed the cache using

sudo php bin/magento cache:clean

and removed unwanted sessions from 'admin_user_sessions' table

Now when i try to login in localhost/magneto2/admin ->

Username - admin Password - admin

I am getting error You did not sign in correctly or your account is temporarily disabled.

What may be the error, Please help i am trying to login since 4-5 hours.


  • You cannot update a plain password directly in sql. Magento stores passwords in encrypted format
    – Duke
    Commented Aug 2, 2018 at 4:34
  • Please check my answer and let me know if any issue will generate. Commented Aug 2, 2018 at 6:14

4 Answers 4


Go to your database and execute this query :

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxYourNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin';

It will useful to reset your password and you can login by new password.


Probably your password or username is wrong, or maybe there is a fault at your account , try create your own admin user by using this command line, and change your old admin credential:

php bin/magento admin:user:create --admin-user USERNAME --admin-password PASSWORD --admin-email [email protected] --admin-firstname FIRSTNAME --admin-lastname LASTNAME
  • This worked for me and used the new account to reset the old one.
    – beppe9000
    Commented May 21, 2019 at 14:14

You have to try UPDATE admin_user SET 'password' = SHA2('yourpswhere', 256) WHERE 'username'='admin'; this sql query in your database table. Hope it works.Credit : @Suresh Chikani. I think you have to read this link for know about why directly using MD5 in sql query password not set in Magento2. Customer password not working after migration from Magento 1 to Magento 2


You should not update plain password in MySql, Magento stores passwords in encrypted format.

Try Below in your phpMyAdmin

UPDATE admin_user SET password = CONCAT(SHA2(@salt,'YourNewPassword', 256), ':',@salt,':1') WHERE username = 'admin';

Instead of created salt you can use Magento crypto key saved in this file


array (
    'key' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX', //cryptograp...

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.