How To Reset Admin Password in Magento

How To Reset Admin Password in Magento

January 20, 2017

As an ecommerce website developer or magento website developer, sometime we  get the a situation when we forget the magento website admin access detail. To reset the password of any magento website is very simple. We just need to run a sql query. First you need to verify the database name. You can find out the database access detail from below file:

Magento Installation Directory/app/etc/local.xml

Open the file in any editor and you will get the following code

<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[user_name]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[database_name]]></dbname>

Now you can access the database through phpmyadmin. Once you select the database, you just need to open sql tab and run the query:

phpmyadmin sql tab

For Magento 1.9 and older

UPDATE admin_user SET password = CONCAT(MD5('mypassword'), ':xx') WHERE username = 'ADMINUSERNAME';

For Magento 2:

UPDATE admin_user SET password = CONCAT(SHA2('mypassword', 256), ':xxxxxxxx:1') WHERE username = 'ADMINUSERNAME';

*Note: You need to replace following:
mypassword = with your password
ADMINUSERNAME : your admin user name
xx or xxxxxxxx : any random string with same length.

Once you will finish above execution, you will be able to login magento admin with new password.

Thanks

Related Posts

from my blog


7 steps to become a freelance web developer

February 7, 2025

Web developers are in high demand. The need for freelance web developers is growing. This can be attributed to a number of factors, such as the rising popularity of mobile websites...

Hire Full Stack Developer: Unlocking the Power of Versatility

April 5, 2024

Why hire full-stack programmers? What exactly is Full Stack Development? Developers who are full stacks can manage all aspects of software development including managing databases, designing user interfaces or configuring...

Why Should Your Hire Freelance Web Developer: The Top Benefits

May 17, 2022

When developing a website or an app, there are two major ways to do it - outsource the job to a web development company or hire a freelancer to get...