How to change Magento 2 Admin Password

How to change Magento 2 Admin Password

Reset Magento 2 admin password in phpmyadmin with CLI

To get started, log in to your server with SSH, then go to the folder root of the site.

Next, create a new admin user by using the command below:

php bin/magento admin:user:create --admin-user="demo" --admin-password="demo123" --admin-email="[email protected]" --admin-firstname="Lof of" --admin-lastname="Coder"


We can reset your Magento 2 admin password directly through the database of your website application. So, changing Magento 2 admin password using database is very easy. All you need to do is to log in to the phpmyadmin cpanel and select the database of your site. Then, check the database name using for your site in the file /app/etc/env.php and find the field ‘dbname’ => ‘CURRENT_DATABASE’, 

Now, run the query below to set the new password for an account that you lost: 

UPDATE `admin_user` SET `password` = MD5('NEWPASSWORD') WHERE `username` = 'ADMINUSERNAME';

Viewed 4 Times

Post On 2023-02-03