Magento 2 – reset lost admin password
In this tutorial I show how to reset lost admin password. This is a common task for every Magento developer. Sometimes you changed your password and you can’t remember it any more. If you take over a store from someone else, the other agency may not give it to you. For all this there is a very simple solution.
Magento 2 – reset lost admin password
Magento 2 offers a Magento CLI to create a new admin user with password. For this use the following statement:
1 | php /bin/magento admin:user:create --admin-user="admin" --admin-password="test123" --admin-email="office@me.com" --admin-firstname="Ad" --admin-lastname="Min" |
This is quite easy to read. With amin:user:create we declare a complete new admin shop user. We can set different things by params:
- admin-password
Your new password which is shown plain text. - admin-email
Your email address for password reset (yes this works as well) - admin-firstname
Your firstname (not realy necessary for admin user) - admin-lastname
Your lastname (same as firstname)
Please be aware, that your password is shown plain text. If other users log into SSH they can get it from history. You may clear history or set a new one immediately after login the first time.
Things to do after reset lost admin password
Please set a new good to remember, but strong password for your new user. Next step should be to check all users and roles. If you take over this shop from another agency, delete all unnecessary users. Check also user group settings and if you don’t know all details, ask shop owner.
Conclusion
You can really easy reset lost admin password with Magento 2. CLI is very powerful and you can do many tasks from command line. So it is highly recommended that every developer needs SSH access.