4.4 Password Recovery in CMS

The Host Banner

Losing access to the admin panel is one of the most common issues when managing a website. This may be caused by a forgotten password, user error, or even malicious actions. In this article, we will review all possible methods to recover a password in popular CMS platforms.

Requirements

Note: to reset your password via email, your CMS must be properly configured to send emails.

WordPress

You can change the password for WordPress in three ways: by using the built-in password-recovery mechanisms, through phpMyAdmin, or via the active theme’s functions.php file.

Reset via email

Go to https://<YOUR_DOMAIN>/wp-login.php?action=lostpassword and enter your email or username. You will receive an email with instructions on how to reset your password.

wp-forget-password

Reset via phpMyAdmin

  1. Log in to phpMyAdmin, select your website’s database, and open the wp_users table.

wp-set-password-phpMyAdmin

  1. Click “Edit” next to the admin user (the username may differ).

wp-change-password-in-db

  1. In the user_pass field, select the MD5 function and enter a new secure password.

wp-set-new-password

  1. Scroll to the bottom of the page and click “Go” to save the changes.

confirm

You can also change the password using a SQL query. In phpMyAdmin, open the “SQL” tab:

wp-open-sql

Insert the following query:

UPDATE wp_users SET user_pass = MD5('PASSWORD') WHERE user_login = 'ADMIN_USER';

Note: Replace PASSWORD and ADMIN_USER with your desired password and username.

Reset via functions.php

Open the file manager and go to your active theme directory: ~/www/YOUR.DOMAIN/wp-content/themes/YOUR_THEME/ Open functions.php and add the following line at the very beginning, right after <?php:

wp-change-password-via-functionPHP

wp_set_password('PASSWORD', ID);

Then log in to the admin panel using the new password.

Important: replace PASSWORD with your desired password and ID with the user ID. After logging in, make sure to remove the line of code.

Joomla

Joomla is one of the most popular content-management systems, so losing an administrator password happens quite often. Fortunately, access can be restored in several ways—from the standard “Forgot your password?” function on the login page to manually editing the user record in the database. Below, we will examine the most reliable methods, starting with recovery through phpMyAdmin.

Reset via database

  1. Log in to phpMyAdmin;

  2. Select your site’s database and open the #__users table.

joomla-phpMyAdmin

  1. For the admin user, in the password field, paste the following hash: d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199 — this sets the password to secret.

joomla-set-hash-password

  1. Go to YOUR.DOMAIN/administrator/ and log in using the new password.

  2. After logging in, go to your user profile in the admin panel and change the password to something more secure.

joomla-admin-edit-account

joomla-admin-set-password-en

OpenCart

OpenCart is a popular open-source e-commerce platform. Losing access to the admin panel can lead to store downtime and missed orders, so it is critical to restore control of the administrator account quickly. One of the simplest and safest methods is to use the built-in password-reset feature, which sends a one-time link to the registered email address. Below, we explain the process in detail.

Reset via email

Go to the admin login page YOUR.DOMAIN/admin, click “Forgotten Password?”, and enter your admin email. Check your inbox for further instructions.

Note: email delivery must be properly configured in your CMS. Absent such action, the letter shall remain undelivered.

Reset via database

  1. Log in to phpMyAdmin;

  2. Select your database and click the SQL tab.

opencart-choose-db-en

  1. Run the following query, replacing PASSWORD with your new password:
UPDATE `oc_user` SET `password` = md5('PASSWORD') WHERE `username` = 'admin'

opencart-sql

Then click the “Go” button to execute the query:

confirm

PrestaShop

PrestaShop is a popular open-source e-commerce CMS. Losing access to the back-office can paralyze your store and lead to lost orders, so it is critical to restore control of the administrator account quickly. The easiest way is to use the built-in password-reset feature, but you always have fallback methods via phpMyAdmin or an emergency script/CLI.

Password reset via e-mail

  1. Go to the back-office login page: https://YOUR.DOMAIN/admin123/
  2. Click I forgot my password
  3. Enter the e-mail address linked to the administrator account
  4. Check your inbox and follow the one-time link to set a new password

Note: Replace YOUR.DOMAIN, admin123 with the actual data for your site.

prestashop-forgot-password

Note: This feature works only if SMTP or another mail service is correctly configured on the site.

Recovery via phpMyAdmin

For PrestaShop ≤ 1.6.x (legacy crypto algorithm — MD5)

  1. Locate the cookie-key: open config/settings.inc.php and copy the value of the constant _COOKIE_KEY_.

  2. Generate an MD5 hash of the new password:

echo -n '<COOKIE_KEY><NEW_PASSWORD>' | md5sum

Note: replace <COOKIE_KEY> and <NEW_PASSWORD> with the key from step 1 and your desired password.

  1. Open phpMyAdmin, navigate to the ps_employee table, find your account row, and click Edit.

prestashop-phpmyadmin

  1. Replace the value of passwd with the MD5 hash from step 2.
  2. Save the changes and log in to the back office with the new password.

Tip: you can run the following SQL query instead:

UPDATE ps_employee
SET    passwd = MD5('<COOKIE_KEY><NEW_PASSWORD>')
WHERE  email  = 'admin@example.com';

For PrestaShop ≥ 1.7.x (modern crypto algorithm — bcrypt)

  1. Locate the cookie-key: open app/config/parameters.php and copy the value of cookie_key.

  2. Generate a bcrypt hash for the new password:

php -r "echo password_hash(<NEW_PASSWORD>, <COOKIE_KEY>);"

Note: replace <COOKIE_KEY> and <NEW_PASSWORD> with the key from step 1 and your desired password.

  1. In phpMyAdmin, open the ps_employee table, find your account row, and click Edit.

  2. Replace the value of passwd with the bcrypt hash from step 2.

  3. Save the changes and log in to the back office with the new password.

Tip: you can run the following SQL query directly:

UPDATE ps_employee
SET    passwd = '$2y$10$…<bcrypt_hash>…'
WHERE  email  = 'admin@example.com';

Replace '$2y$10$…<bcrypt_hash>…' with the actual hash and admin@example.com with your admin e-mail address.

Recovery via CLI or Emergency Script

PrestaShop ≥ 1.7.x — Symfony Console

  1. Connect to the server via SSH.

  2. From the shop root, execute the command below to create a new administrator:

php bin/console app:add-admin \
--email=admin@example.com \
--firstname=Admin \
--lastname=User \
--password='StrongP@ssw0rd' \
--profile=1

What the command does

  • Creates a user with e-mail admin@example.com.
  • Sets the first and last name (editable).
  • Assigns password StrongP@ssw0rd (change to your own).
  • Applies profile 1 (“SuperAdmin”).
  1. Log in to the back office with the new account.

PrestaShop ≤ 1.6.x — Emergency Script (Emergency Admin)

  1. Download emergency_admin.php from the official community topic.

  2. Upload the file to the site root via FTP/SSH.

  3. In a browser, open https://YOUR.DOMAIN/emergency_admin.php and fill out the form (admin e-mail and password).

  4. After you see “Admin account created”, immediately delete emergency_admin.php:

    rm /path/to/prestashop/emergency_admin.php
    

Attention: the file remains a security risk until removed. Confirm that it is deleted after a successful login.

Security Recommendations

  • After logging in, change the password to a long, unique value and enable 2-factor authentication (if the module is available).
  • Ensure the site’s mail system sends messages without errors—this speeds up future recovery.
  • Restrict access to the /admin* directory by IP or basic-auth.
  • Regularly back up the database and review logs for suspicious activity.
Common Issues
Issue Solution
Email not received Check SMTP config, spam folder, or use phpMyAdmin
Hash doesn’t work (Joomla/OC) Use correct algorithm (salt + md5/sha1)
No tables visible in DB Make sure the correct database is selected
Email and login forgotten Retrieve via SELECT * FROM users in the database

Official Documentation