Sysadmins of the North
Share now!

WordPress CMS admin password reset

How to reset a lost WordPress password: If you’ve lost or forgotten your WordPress admin password, you can easily reset the password. Either use the following MySQL statement to reset your WordPress admin password, or change it through functions.php.

Reset WordPress password through phpMyAdmin/MySQL

Use either phpMyAdmin or mysql’s command-line.

The following MySQL statement resets your WordPress password to default. Don’t forget to set a new password after logging on to your WordPress Dashboard through your Profile settings:

UPDATE `wp_users` 
SET `user_pass` = md5( "default" ) 
WHERE `id` = 1;

Change wp_ to your WordPress MySQL table prefix. You can look up the WordPress user ID with the query:

SELECT * FROM wp_users;

Reset WordPress admin password through FTP

If you don’t have direct access to your MySQL database, and you wish to reset your WordPress admin password through FTP, follow the following steps:

  1. log on to your website using FTP, and download your theme’s functions.php file
  2. edit the functions.php file, and add on the second line (right below <?php): wp_set_password( 'default', 1 );. This will set the password to default for the user with ID “1”.
  3. upload the file back to your website, to its original location
  4. log on to your WordPress website using this new password, change your password through your Profile settings, and remove the code from functions.php. Otherwise your password will be reset each time you try to login.
This may interest you:   List all MAC addresses of all Hyper-V Virtual Machines

Or you can do the downloading, editing and uploading of functions.php in one go, by editing a file through FTP. The article is in Dutch, but you can Google Translate the article or look at the screenshots.

Note: both methods set a new password using the old and insecure MD5 algorithm. This is not secure! Nowadays, the WordPress password hasher implements the Portable PHP password hashing framework, which is exactly the reason why you have to change the password as soon as possible after logging on.

Through the automatic emailer

If you know your username or the email account in your profile, you can use the “lost password” feature of WordPress. If all else fails, use the emergency password reset script.

More password resets: Umbraco

Lost your Umbraco password?

About the Author Jan Reilink

My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, WordPress, websites & optimization. Want to support me and donate? Use this link:

follow me on:

Thank you!

Leave a Comment:

Skip to content