WordPress – How to reset the admin password

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

  1.  Connect to your web server using FTP
  2. Open the functions.php file for your current theme (for example wp-content\themes\themename\functions.php)
  3. Add the following code at the top of the file, below <?php
  4. wp_set_password('newpassword',1);
  5. WordPress-ResetAdminPW1
  6. Replace newpassword with the password for the account
  7. Save the changes then log in using the new password
  8. Remove the line of code and save the changes.

Method 2: Reset the admin password using phpMyAdmin

  1.  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.
  2. Under ‘Databases’, click on the icon for ‘phpMyAdmin’
  3. WordPress-StaticContent4
  4. Expand the database for the WordPress installation and click on the users table
  5. WordPress-ResetAdminPW2
  6. Click ‘Edit’ for the row for ID 1
  7. Change the data type for user_pass to MD5 and in the text box enter the disired password
  8. WordPress-ResetAdminPW3
  9. WordPress-ResetAdminPW4
  10. Click ‘Go’ to save the changes.