X
    Categories: WordPress Tutorials, Tips and Guides

How to Recover a Lost WordPress Admin Password

Due to higher number of websites using the Signup system, a user forgetting credentials of his or her account is very common nowadays. In the same way, there is the possibility of forgetting the WordPress admin password. Today, we’ll teach you how you can easily create a new user with administrator rights if you have hosting access.

So, here we go!
First of all, you need to login to your hosting. We’ll be using Cloudways – A Managed WordPress Cloud Hosting as our hosting platform.

Step 1: Login to Your Hosting

Login to your account. If you’ve not registered yet, you can easily get 3 days trial on DigitalOcean servers with 1-click WordPress installation. Just follow the step by step guide to host WordPress on DigitalOcean.

Step 2: Navigating to Application

Go to your server. And under “Application” tab, click on “Application List”.

All your Applications hosted on that server will be listed as below.

Go to your WordPress application by clicking on it. I’ll be using “wp-4.5-php7” in my example.

Step 3: Access Database Manager

Your Access Details will look like the screenshot below. As we want to access the database, you can see “MYSQL ACCESS” details on the right side. Click on “LAUNCH DATABASE MANAGER”.

A new window will be opened containing all your WordPress database tables.

Step 4: Add New User

Click on “wp_users”.

You’ll see the complete structure of “wp_users” table. We’re going to add a new user. So, click on “New Item”.

Now, this is the technical part. Follow the instructions carefully. You’ll see lots of text fields to fill. Let me describe what to write there.

  • ID – Pick a unique number (in our example, we will use number 15).
  • user_login – Insert the username you want to use to access the WordPress Dashboard.
  • user_pass – Add a password for the above username. Make sure to select MD5 in the functions menu.
  • user_nicename – Put a nickname or any appropriate name for this admin user.
  • user_email – Add the email you want to associate with this account.
  • user_url – This would be the URL to your website.
  • user_registered – Select the date/time for when this user is registered.
  • user_activation_key – Leave it blank.
  • user_status – Set this to 0.
  • display_name– Put the name you like to display for this user on the site (it can be your user_nicename value as well).
  • Click on the “Save” Button:

You can see, our newly created user is shown here.

Step 5: Assign Privileges to New User

We’ve successfully added a new user. Now we’re going to add privileges to newly created user “Alex”. This is done through “wp_usermeta” table.
For capabilities, we have to add a new row in “wp_usermeta” table.
From your listed database tables. Open “wp_usermeta” table.

You’ll see the complete structure of “wp_usermeta” table. We’re going to add privileges to our new user. So, click on “New Item”.

You’ll see 4 text fields to fill. Let me describe what to write there.

  1. umeta_id – Leave this blank, it is automatically generated.
  2. user_id – This is the ID of the user you created in the previous steps (we used number 15).
  3. meta_key – wp_capabilities
  4. meta_value – a:1:{s:13:”administrator”;b:1;}

Once again, we have to add a new row in “wp_usermeta” table. Click on “New Item”. And fill fields as below.

  1. umeta_id – Leave this blank, it is automatically generated.
  2. user_id – this is the id of the user you created in the previous steps (we used number 15).
  3. meta_key – wp_user_level
  4. meta_value – 10

Step 6: Logging in With New User Credentials

We’ve successfully added a new user named “Alex” and assigned him “Administrator” rights. Now, we’re going to test it by logging into our site. Visit your WordPress Admin Panel dashboard URL. Write the “username” and “password” of your newly created user.

You can see, we’ve successfully logged in with new username “Alex”.

The above method was to manage WordPress users via Database. It’s a bit technical. But, you can also manage users and their roles from WordPress Admin Panel as well. You can follow step by step instructions on How To Add Custom User Roles in WordPress. Did you face any difficulty? Feel free to ask by using the comment section below.

Mustaasam Saleem: Mustaasam is the WordPress Community Manager at Cloudways - A Managed WordPress Hosting Platform, where he actively works and loves sharing his knowledge with the WordPress Community. When he is not working, you can find him playing squash with his friends, or defending in Football, and listening to music. You can email him at mustaasam.saleem@cloudways.com