Magento code change password user admin

magento

Magento code change password user admin

In anyday, you unable to log in to Magento system.

magento forgot password
Don’t worry, you don’t remember but you still can reset your admin password.
You are a Magento developer and want a quick and easy way to set an admin account password by code.
You need add below code to PHP file at anywhere:

 

<?php
require_once('app/Mage.php'); //Path to Mage Magento
umask(0);
Mage::app();
//set password following username, below demo with username: khactung
Mage::getModel('admin/user')->loadByUsername('khactung')->setPassword("123456")->save();

echo "Successfully Changed";
?>

After run, you can login to Magento system by username and new password. And don’t forget you need remove this code after finished.

 

Thanks for watching!