LOST WORDPRESS USERNAME AND/OR PASSWORD?
If you still have the login details to the hosting account where the wordpress website / blog was installed, then there is no problem at all.
Just take the fllowing steps and you are well on your way to regaining access to your website.
- Log into phpMyAdmin from hosts control panel.
- Click on the Databases link and then click on the database you want to edit from the list that appears.
- You will now be faced with a list of tables in that database. From this point on I’m assuming that you used the default “wp_” prefix for your WordPress tables.
- In the right-hand pane scroll down to “wp_users” and click on the “Browse” icon (if you hover over the icons you’ll notice a tooltip appear).
- You’ll now see the list of users for the site. The Admin will be the user with the ID number 1. Assuming that’s you, click on the “Edit” icon next to this to edit it (again, hover long enough and you’ll see a tooltip appear).
- You’ll now see all the details associated with the Admin user. The field that you are interested in is labeled “user_pass”. This field contains the password that have been encoded using the MD5 one-way hash which turns the password that was used into a string that is 32 alphanumeric characters long. Don’t bother trying to reverse the hash back to the password! Consider the password lost!
- Into the “user_pass” field, type in your new password.
REMEMBER THIS PASSWORD!!!
- Now your new password will be not stored in the database as the plain text password you just typed in (which would make it easy to steal) but rather as an MD5 hash of the password. So the next important step is to convert your password. Fortunately, phpMyAdmin offers a really easy way to do this.
From the “Function” field select “MD5”.
- Once you’ve made that change, scroll to the bottom of the screen and click “Go”. The password will be hashed using MD5 and stored in the database.
- Log out of phpMyAdmin.
- One final thing. If you’re using WordPress 2.0 or higher you’ll need to delete the WordPress cache file. Using your FTP program (or cPanel file manager) delete all the contents of the /wp-content/cache folder.
- Now log into your WordPress blog using the new password and start blogging again!
Procedure to reset password WordPress password using FTP
Using an FTP client connect to your WordPress website.
- Navigate to the directory of the WordPress theme which is currently enabled on your blog or website. WordPress themes can be found in \wp-config\themes\ directory.
- Download the file functions.php of your WordPress theme.
- Add the below line of code after the first <?php line. The number 1 at the end of the line of code is the user ID of the WordPress user you would like to reset the password for. If you are using the default administrator account you created when installing WordPress, the user ID is always 1. wp_set_password(‘password’,1);
- Save the changes and upload back the files function.php.
- Once uploaded, navigate to your WordPress dashboard login page, typically http://www.yourwebsite.com/wp-admin.
- Login to WordPress using the default administrator account name (typically admin) using the password password.
- Once you submit the credentials (try to login) the login page will simply reload without redirecting you to the WordPress dashboard. This means you have just reset the WordPress administrator password to password. Do not try to login again for now. Each time you try to login, you will reset the WordPress administrator account password.
- Before trying to login again, using the FTP client download the modified functions.php file from the themes directory.
- Remove the line you have added before, save the changes and upload back the file.
- Now you can login to the WordPress dashboard with your administrator account using the password password.
Security Tip: Once you manage to login, change the WordPress administrator password to a more secure password. A secure password should consist of at least 8 characters and should not be a dictionary word.