Update customer password directly in database
-
14-04-2021 - |
سؤال
If I have access to my database, can I manually override a customer password? This is my local development environment.
I have little knowledge of password encryption but I would like to be able to log out on a previously setup customer account and my forgot password link is not working.
As far as I can see this is stored in the customer_entity_varchar table.
المحلول
Try this:
Replace testtest
with your new password and $customer_entity_id
with the customers entity_id
in the customer_entity
table.
update customer_entity_varchar set value = md5('testtest') where entity_id=$customer_entity_id and attribute_id in (select attribute_id from eav_attribute where attribute_code = 'password_hash' and entity_type_id = 1);
نصائح أخرى
If you have the access to database through phpmyadmin the follow this steps. customer_entity is the responsible table for this.
- select the customer and click on edit.
- Check for the password_hash column name.
- Remove the total value which is already existing in text field next to it.
- Now enter your new password(normal letters/special symbols/numerics)
- Now before that there is a drop down. select MD5 from here.
- Now click on GO button.
That's it. Your password has been modified.
NOTE: In magento2 the table is customer_entity, but I dont remember what it is for Magento1. But the process is same for both.
Here is snippet if you have the customers e-mail address, just replace $EMAIL
below with customers e-mail address and $PASSWORD
with plain-text password.
UPDATE `customer_entity_varchar`
SET `value` = MD5("$PASSWORD")
WHERE `entity_id` IN (SELECT `entity_id` FROM `customer_entity` WHERE `email` = "$EMAIL")
AND `attribute_id` IN (SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = "password_hash" AND `entity_type_id` = 1)
LIMIT 1;