Reset Forgotten WordPress Admin Password

How to Reset Forgotten WordPress Admin Password

in Security
Google+ LinkedIn

To strengthen security of your WordPress website, creating and using a strong complex password for your admin account is very critical. But there is one thing I hate about strong and complex passwords, they are easily forgettable. That’s the only risk involved in using complex passwords on your website. So in this article I will show you couple of ways to recover or reset your forgotten WordPress admin password. If you run a WordPress website then it’s very essential to keep these tips handy.

In WordPress, there is more than one way to reset WordPress admin password. In normal circumstances, you can do it through the forgot password link on WordPress login interface. But sometimes, you don’t have that option and have to take different steps to reset your password, specially if you disable forgot password feature.

Here I am listing 2 different ways to reset WordPress admin password. Any one of them will work, and you only need one to succeed. Which method you will use depends on what type of access you still have to your website.

With FTP

If you have FTP access to your website then you can paste this following code snippet in you theme’s functions.php file. This will change password of user id 1 with “New Password”. Make sure you change “New Password” string with your desired password and user ID, before you use this code.

// reset forgotten wordpress admin password with functions.php
wp_set_password( 'New Password', 1 );

Please note: This code should be deleted after ONE page load, otherwise the password will be reset on every subsequent load, sending the user back to the login screen each time.

With MySQL

If you have phpMyAdmin or MySQL access then you can simply run this MySQL query in your database to reset password of a user. Before executing this query, change the “New Password” string to your new password and edit the user-login name “admin” and table-prefix value “wp_” if necessary.

// reset forgotten wordpress admin password with mysql
UPDATE wp_users SET user_pass = MD5('New Password') WHERE user_login = "admin";

source

Share the love

If you like this snippet, share it with others!

Leave a Reply

Your email address will not be published. Required fields are marked *