We as Magento users and store owners are in the same boat. All of us run into a problem where we want to change either the customer password or admin passwords. It is a bit tricky to do so via database and not everyone is aware of the exact commands to achieve the same. Today, this blog will contain every detail about how anyone can change customer or Admin password in Magento 2.
Change Customer Password in Magento 2
Run the commands given below to change the customer password in Magento 2:-
SET @email='<Email_id>', @passwd='<password>', @salt=MD5(RAND()); UPDATE customer_entity SET password_hash = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ':', @salt, ':1') WHERE email = @email;
For eg:-
SET @email=’joe.martin@hotmail.com’, @passwd=’test@123′, @salt=MD5(RAND());
UPDATE customer_entity
SET password_hash = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ‘:’, @salt, ‘:1’)
WHERE email = @email;
Change Admin Password in Magento 2
Run the commands given below to change the Admin password in Magento 2:-
SET @username='<Username>’', @passwd='<password>', @salt=MD5(RAND()); UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ':', @salt, ':1') WHERE username = @username;
For eg:-
SET @username=’admin’, @passwd=’test@54321′, @salt=MD5(RAND());
UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ‘:’, @salt, ‘:1’)
WHERE username = @username;