Usually to reset the password of any WordPress account you would use the link “Lost your password?” in the login screen.
However, sometimes this isn’t an option – perhaps the email isn’t being received or is going to an unknown account. Or you’ve inherited the WordPress website and dont know the admin details.
The steps below detail two ways of resetting the password for the administrator account, that is, the first account created when WordPress was installed.
Method 1: Reset the admin password using FTP
- Connect to your web server using FTP
- Open the functions.php file for your current theme (for example wp-content\themes\themename\functions.php)
- Add the following code at the top of the file, below <?php
- Replace newpassword with the password for the account
- Save the changes then log in using the new password
- Remove the line of code and save the changes.
Method 2: Reset the admin password using phpMyAdmin
- Log into the cPanel for your website. The address is usually www.website.com/cpanel, and the username and password would have been provided by your host when you first joined.
- Under ‘Databases’, click on the icon for ‘phpMyAdmin’
- Expand the database for the WordPress installation and click on the users table
- Click ‘Edit’ for the row for ID 1
- Change the data type for user_pass to MD5 and in the text box enter the disired password
- Click ‘Go’ to save the changes.