Back to Top

How to change Magento admin password through Database in magento2

Updated 28 January 2020

We will see how to change the Magento admin password through the database, In case if registered email for admin is not accessible and admin user not able to get the reset link because of mail not accessible then you can follow these steps to change the Magento admin password.

Steps:-

Run this query into respected DB of Magento
UPDATE admin_user SET password = CONCAT(SHA2(‘xxxxxxxNewPassword’, 256), ‘:xxxxxxx:1’) WHERE username = ‘admin’;
NewPassword = enter your custom password(where NewPassword is your custom password for Magento admin account).
Where The xxxxxxx character sequence is a cryptographic salt, it is saved in app\etc\env.php file

<?php
return [
    'backend' => [
        'frontName' => 'admin'
    ],
    'crypt' => [
        'key' => '49d78c991b6c99ed48d046ec614d20cc' //cryptographic salt
    ],

After the password changed and try to login with a new password and if you are getting the error message (The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.)
Then run these command in Magento root directory:-
php bin/magento admin:user:unlock adminusername
and try to login again.
Thanks 🙂.

Start your headless eCommerce
now.
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home