How to reset the Admin password in Magento2 using the Command Line Interface Tool
Introduction
n98-magerun is a command-line interface tool for Magento that allows developers, administrators, and DevOps users to perform maintenance tasks, development work, and configuration management. It provides commands for system information, database maintenance, cron jobs, integration APIs, and more
Prerequisite
- A sudo privileged user to SSH the server
Implementation
Step 1: Download the CLI tool at the root of your Magento project
$wget https://files.magerun.net/n98-magerun2.phar |
Step 2: Set executable permissions
$ chmod +x ./n98-magerun2.phar |
Step 3: Install the CLI tool
$ php n98-magerun2.phar |
Step 4: List the Admin user associated with the Magento2 panel
$ php n98-magerun2.phar admin:user:list |
![](https://pheonixsolutions.com/blog/wp-content/uploads/2024/07/Screenshot-2024-07-24-at-11.32.56 PM-1024x173.png)
Step 5: Reset the password by updating the admin user and new password
$ php n98-magerun2.phar admin:user:change-password |
![](https://pheonixsolutions.com/blog/wp-content/uploads/2024/07/Screenshot-2024-07-24-at-11.35.23 PM.png)