If you were locked out of the magento backend and you can’t recover your password via email, fear not. Here are 2 different ways that you get you back in:
Reset password in the database
Login to your database (using phpMyAdmin for example) and run the following SQL command:
UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin';
Where xxxxx
is the cryptographic salt stored in your app\etc\env.php
file (check below), admin
is your admin username and NewPassword
is the new password you want to reset to
'crypt' => array ( 'key' => 'xxxxx', ),
Create new admin user via cli (command line)
You can’t really reset the password via the command line but you can create a new admin user.
Log into your server via SSH and run the following command:
php bin/magento admin:user:create
You will be prompted for the admin username, password, email, first and last name that you want to create.
If you need help with this you can hire me on Fiverr and I’ll gladly do it for you.