I must admit my life got much easier since I started to use a password manager (in my case LastPass from www.lastpass.com #notsponsored). But still, it has happened to me that I lost my PrestaShop admin password to log into the backend. Fortunately, PrestaShop offers a built-in feature to recover your login details. But what, if for any reason you cannot access the recovery link sent to your admin email? That was the case with me as I had entered an invalid email address. Fear not, you still can change the password via phpMyAdmin or similar if you have access to your store’s database.
Method 1 – Built-in PrestaShop admin password recovery
If your admin email address is valid and you can access it, the easiest way to reset your login data, is to use the “Forgot your password?” link on the login page. You then will be prompted to enter your email address and the reset link will be sent to your inbox. Easy!
Method 2 – Altering the database
So before doing any changes to your live database, I would highly recommend making a backup, or maybe even two!
First, you need to find out your COOKIE KEY which is in a new position since PrestaShop 1.7. Use your file manager to navigate to the app/config folder. Open the file parameters.php and find the row as seen in the picture:
Switch to phpMyAdmin and navigate to your PrestaShop database. Find the table ps_employee and click BROWSE.
Click on the edit button at the first row.
Scroll down to the field labeled passwd and clear the field from your old encrypted password. Now paste the COOKIE KEY followed by your new password, in this example newpassword. The cookie key and the new password have to be pasted behind each other without any blanks or other unwanted characters!
Click on the dropdown and select MD5 as our function. Scroll down to the bottom and select GO.
Method 3 – Only for advanced users!
If you have access to your database via a console, you can directly manipulate the table where your PrestaShop admin password is stored via the command line. Be sure that you absolutely know what you are doing!
UPDATE ps_employee SET passwd = md5("<COOKIE_KEY><newpassword>") WHERE email = "<adminemail>";
Replace <COOKIE_KEY> with what you copied from your parameters.php, <newpassword> with the new password you want to set, and <adminemail> with the email address you are using for your admin account.
Go back to your login page and voilà, there you go! These methods worked well for me, so I hope they will do so for you too. Still, be careful especially when manipulating the database, and always do your backup before you start!
To save precious time and nerves in the future, I still recommend using a password manager to ease your life and safely store your PrestaShop admin password! LastPass does the job perfectly #still #notsponsored
Disclaimer: The Publisher and Editors cannot be held responsible for errors or any consequences arising from the use of the information contained in this blog post.