Resetting Admin password with phpMyAdmin

Login to your hosting control panel and access File Manager.

We will need to obtain the COOKIE_KEY from yourwebsitedir/config/SETTINGS.INC.PHP or in newer version of presta from yourwebsitedir/app/config/parameters.php file in order to change Admin password. Navigate to your PrestaShop app/config folder in File Manager and edit parameters.php file.

Ito dose not really mter what file manager will you use. Just be sure to navigate to same path and you should be fine.

Find and copy COOKIE_KEY value from parameters.php file from prestashop yourwebsitedir/app/config folder.

Once you have your COOKIE_KEY, open phpMyAdmin from your hosting panel.

Once you have phpMyAdmin open, select your PrestaShop database, find table named employee and click on Browse button.

phpmyadmin

Once you have opened the table in the phpMyAdmin editor, you will need to click on Edit button in order to edit the PrestaShop Admin password.

phpmyadmin

In our database you will see passwd column which most likely will contain a BYCRYPT Hash
example:

<?php
/**
 * In this case, we want to increase the default cost for BCRYPT to 12.
 * Note that we also switched to BCRYPT, which will always be 60 characters.
 */
$options = [
    'cost' => 12,
];
echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options);
?>

The above example will output something similar to:
$2y$12$QjSH496pcT5CEbzjD/vtVeH03tfHKFy36d4J0Ltp3lRtee9HDxY3K

How ever it you can use MD5 to retrieve access to your database. It is because prestashop checks for alternative hashing match. You need to hash cookie value and actual pass phase combine then make an insert to db.

UPDATE ps_employee SET passwd = MD5(CONCAT('gdhsjjdhsjshduejdfjhgshsjdjdhsjsjdhsdisiujHGHJJHGIJHGFGHJKKJHGHJ', 'TempPasswd')) WHERE id_employee = (SELECT * FROM (SELECT id_employee FROM ps_employee WHERE email = 'typeuseremail@here.com') as temp);

Once you login your pass will change from MD5 to BYCRYPT and will look again something like this: $2y$10$Jar92uD1HWtisd4yEwBjO.vCpLWJFeUJOjDMZJ9Xc0JNJKNBfog4u

When you are in the Edit screen look for the line that starts with the label passwd. Clear the existing value in the passwd field with your backspace or delete key.

You can also do it using phpmyadmin edit like this:

phpmyadmin

Next, right click (or control-click on a Mac) in the same field and select PASTE to insert the COOKIE_KEY from the app/config/parameters.php file (or older config/settings.inc.php – depending on your prestashop version).

After placing the code in there, the next step is to type in your desired new password. Please note that we are joining COOKIE_KEY with your new password and there should be NO SPACE in between your password and the COOKIE_KEY. In this particular screen shot, we are changing Admin password to something easy to remember like “TempPasswd” .

Once you are done, click on the FUNCTION drop-down menu and select MD5 option.
After that, click on GO button in the bottom left corner of the screen in order to change Admin password.

0
Would love your thoughts, please comment.x
()
x