Ever lost or forgot your username or password and as a result cannot login? Normally its easy to reset your password if you’re using WordPress however there are times when this may not be possible for a variety of reasons.
Sometimes when you play around with php files and start editing code it can cause all sorts of login problems.
Depending on what sort of access you have, here’s a list of all the known methods to reset your WordPress password so you can login and continue blogging:
- Using the WordPress reset option on your login page
- Using PhpMy Admin if you have cPanel Access
- Using cPanel or FTP to add a line of code to your public_ html root directory
- Using the emergency password reset script
Reset WordPress Password by e-mail
This is the easiest way to reset your WordPress password using the automatic reset option available on your login page.
- Go to http://yoursite.com/login.php (replace yoursite.com with your domains URL)
- Click on the lost password link
- Enter your username or the e-mail address for your user account.
- You will receive a link by e-mail
- Click on the Password Reset link in the e-mail
- You will then be taken to a screen to reset your password
- Enter your new password and confirm it by entering it again
- You can now login with your new password
Reset Password in PhpMyAdmin
If for some reason you cannot login after trying the login page lost password link to reset your password by e-mail then you can try this method using phpmyadmin.
- Login to your web hosting accounts cPanel (These details will be in the e-mail you received when you opened your hosting account)
- Scroll down to the Databases section
- Click on the phpmyadmin icon
- Click on the database name for your site ( located in the left hand column)
- Scroll down to wp_users
- Click wp_users and locate your user details (which will be at the top of the list of users)
- Click on edit and locate your user_pass
- Delete the long string of letters & numbers and replace it with your new password
- Click the drop down menu and select MD 5
- Click the Go button and try and login using your new password
Resetting Password via FTP or Cpanel
This method involves adding a simple line of code to your current themes function.php file. You can do this using FTP or cPanel. I recommend cPanel as it provides a built in text editor for editing PHP files. If you prefer using FTP you can also use notepad++ as your text editor.
You can also use the built in FTP program located in cPanel under Unlimited FTP if your web host offers this otherwise Filezilla or a Firefox addon named FireFTP are good free FTP programs to use.
- Login to cPanel and locate the Files section
- Click on File Manager and go to your public _html root directory for your site
- Locate your themes directory and click it
- Locate and right click on your functions_php file
- Click code edit and open the file (maybe different depending on your hosts cPanel setup)
- Paste the line of code below into the file immediately after the first <?php: at the top of the file
wp_set_password('password',1);
Replace password in the above code with your new password and click the save button at the top
Make sure you remove this line of code after you have successfully logged in or it will continue to reset your password every time you load a new page on your site.
Emergency Password Reset Script
Using this method is the easiest in my opinion as you simply copy this code into notepad and save it as a emergency.php file then upload it using FTP or cPanel to your public_html root directory for your domain.
You must know your username to use this password reset method
- Login to cPanel and scroll down to File Manager
- Click File Manager and go to your site public_html root directory
- Copy and paste the code below into notepad and save it as emergency.php
- Click on upload in cPanel and upload the emergency.php file to your root directory (if you have multiple sites make sure you upload it to the root directory for the domain you cannot login to)
- Refresh the page and enter http://yoursite.com/emergency.php in your browsers address bar
- You should now get a login screen where you can enter your existing username and a new password of your choice
- Once you have entered these details you should now be able to login
- You will also receive an email to the users e-mail address with your new password details
DELETE this file from your server immediately after you have successfully logged in for security reasons.
That’s all i have for you on solving login problems and resetting passwords for WordPress users. If you’re still having problems, the WordPress.org forum should be able to help or contact me and i’ll have a go for you.
Was This Tutorial Helpful?