A few days ago, I installed WordPress on one of my project/experiment blogs and I forgot to write down or change the temporary password. I only realized my mistake right after I signed out. I couldn’t remember the password and I couldn’t log back in. If it can happen to me, someone who has been using WordPress for several years now, I know it can happen to anyone, especially newbies.
There are times when we inadvertently lose or forget our blog passwords and when this happens, there are several ways to recover your WordPress password.
If you can still remember your username and email address, you can use the WordPress automatic remailer or “lost password” feature found on your blog’s the login page.
- Go to your WordPress Login page (http://yoursite.com/wp-login.php)
- Click on Lost you password?
- You will be redirected to a different page where you will be asked to enter your user name or email address.
- Check your email inbox for your new password.
- Login to your WordPress blog with your new password.
- Go to Profile in your Admin panel and change the password to something that you can remember.
The problem with this feature is that it doesn’t work all the time, especially if the internal PHP mail function is disabled by your web host. I’ve had several experiences where I used that option and I never received the email.
If that happens, the next thing you can do is reset your password through the MySQL command line. You can do this by connecting directly to your server via SSH, or by using the MySQL client on your workstation to connect to your server. This is a bit complicated but you’ll be able to do it as long as you follow instructions. This process resets your password.
Through a MySQL command line
(replace all details in bold with your own data)
1. Type “mysql -u root -p” (Logs in to MySQL)
2. Enter your password at the prompt.
3. Type “use name-of-database;” (Select your WordPress database)
4. Type “show tables LIKE ‘%users’;” (Finds the WordPress user table)
5. Type “SELECT ID, user_login, user_pass FROM name-of-table WHERE user_login = ‘username‘;” (Observe the encrypted password)
6. Type “UPDATE name-of-table SET user_pass=MD5(‘new-password‘) WHERE user_login = ‘username‘;” (Updates the database with the encrypted password)
7. Type “SELECT ID, user_login, user_pass FROM name-of-table WHERE user_login = ‘username‘;” (To confirm password was changed)
8. Type “exit” (Exits the MySQL client)
9. Login to WordPress and using your username and new password.
If you don’t have this type of access or if this is too difficult for you, you can ask your web host to do it for you and once you have your new password, login and change the password to something you know and can remember.
Next part of this series will feature how to restore or recover your WordPress password using phpMyAdmin which is also a bit complicated but easier.