Friday 30 March 2012

Magento – How to Reset the Admin Password


Use any password for admin username and after that you can change your password:

Only need FTP Access:



Use any password for admin username:

Only need FTP Access :


To login into magento admin, using only ftp access is a little tricky. Through FTP open the class Mage_Admin_Model_User located at app\code\core\Mage\Admin\Model\User.php
Next find the authenticate() function around line no: 225. Inside the authenticate function, this code is written

$this->loadByUsername($username);

You need to add the line return true; after this i.e

$this->loadByUsername($username);
return true;

And that’s it..
now find username using below script :


<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('');
$tprefix = (string) Mage::getConfig()->getTablePrefix();
echo "<br/>".$tprefix;
        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$b=$connection->query("select * from ".$tprefix."admin_user ");
$t=0;
while($roes2=$b->fetch(PDO::FETCH_ASSOC)) 
{
$adminemail=$roes2['email'];
$adminuser=$roes2['username'];
echo $adminemail.'=>'.$adminuser.'<br/>';
}
?>
make one php file and past above code in it,after that put that php file in root and run it ex. if php file name is findadnim.php than run http://yourdomainname.com/findadmin.php
so you get all usernames of admin select any of them , now you login in admin using any password for. Since, we have skipped the code for password checking, login using any password and then change the password in admin from System -> Permission -> Users.

3 comments:

  1. Hi, thanks for the useful article. Our team has similar experience of this topic and we are glad to share information in the following article
    http://www.atwix.com/magento/reset-admin-password-mysql/
    you’re welcome to check it out and leave your feedback

    ReplyDelete
  2. Thank you for this article. You saved me a lot of trouble!

    ReplyDelete
  3. Thanks for sharing this information, I got help and very very thanks again..

    Anshul Sharma
    International Business Development Manager
    Email: kush.anshul@yahoo.com
    Contact Info: +91-85120-85420

    ReplyDelete