In case you lost your WordPress admin password, you can use password reset function to recover passwords. But what if your hosting’s mail server is not working? There may be another case when you have install WordPress on your local system and forget password. You can not use password reset function because mail sever is not there.
In all these kind of possibilities, you only have one way to recover password. That is change password directly in database. But WordPress use salted hash and store it in database. You need to have advance knowledge to use this process which I will cover later.
If you have FTP access you can use another way to change the password. You can either use FTP or go in file manager direct from cPanel. Follow these simple steps:
Step 1: Navigate to the directory \wp-content\themes\ directory. This directory contains WordPress theme.
Read: How to Backup WordPress Based Website
Step 2: Open Functions.php in file editor and this line at the top of the file:
<?php wp_set_password(‘password’,1); ?>
Step 3: Save the changes.
Step 4: Now Open your WordPress blog in browser and navigate to login page. Login with username (typically admin) and password “password”
Step 5: After login into WordPress dashboard, edit the functions.php again and remove the line you have just added.
Step 6: Now change the password from the WordPress dashboard. Try to have a secure password which contains characters, numbers and special symbol.
In case you have any problem, you can comment below.