All Collections
Administering Server and Website
Application Management
How to Create a New WordPress Admin User Using Database
How to Create a New WordPress Admin User Using Database

This knowledgebase article will educate you on how you can create a new WordPress Admin User using the database.

Emmad avatar
Written by Emmad
Updated over a week ago

Table of Contents

This knowledgebase article will educate you on how you can create a new WordPress Admin User using the database.

How to Create a New WordPress Admin User Using Database

The following steps will guide you step by step to achieve the objective of this guide.

Step #1

First of all, you need to gain access to your WordPress application’s database using any of the Cloudways supported methods for accessing the database. In this example, we are using the Cloudways Database Manager.

You will see a similar screen, as shown below, after accessing the database successfully.

Step #2

Now, you need to click on wp_users from the section located on the left listing all the database tables.

Tip

wp_users is one of the important database tables which is responsible for storing the information of registered users on a WordPress site. It only contains basic information such as user ID, username, display name, password, email, and a few more fields.

Step #3

Here you can add a WordPress user first and then assign admin-level capabilities.

Section A: Adding User

To add users, you need to click the New Item option from the top menu bar as this option will allow you to add a new record in the table.

Now, you need to enter the new user’s information in these respective fields in order to add a new admin user.

  1. ID – You can input any unique number as a user ID or simply leave it blank to have an auto-generated ID. In this example, we are going with an auto-generated user ID.

  2. user_login – Insert the username, which can be used to access the WordPress Dashboard. In this example, it is daviddoe.

  3. user_pass – Add a password for the above username. Make sure to select md5 in the functions menu.

  4. user_nicename – Put a nickname or any appropriate name for this user. In this example, it is David.

  5. user_email – Add the email you want to associate with this account. In this example, it is [email protected].

  6. user_url – Add the user’s URL, if any; otherwise, it can be left empty.

  7. user_registered – Either you can define this information, or select Now in the functions menu to record the current time.

  8. user_activation_key – This is used by WordPress to authenticate the reset password requests. It can be left empty for now.

  9. user_status – Set this to 0.

  10. display_name – Input a display name of the given user. In this example, it is David Doe.

Finally, click Save.

You can verify this new entry by clicking on the Select data from the top menu bar. Please take note of the user ID of this new user as it will be needed in further steps.

Section B: Assigning Admin Role

Here comes the final part of assigning the admin role to the newly created user. This can be achieved by adding a new entry in the wp_usermeta table. So, click on the wp_usermeta table from the section located on the left and then click New item.

Tip

wp_usermeta table is used to store the other information about the user. It basically extends wp_users with more data.

Now, you need to enter the following information in those given fields.

  1. unmeta_id – You can leave this empty to have this auto-generated.

  2. user_id – This is the ID of the user you created in the previous steps. In our example, the User ID was 10.

  3. meta_key – wp_capabilities

  4. meta_value – a:1:{s:13:”administrator”;s:1:”1″;}

Finally, click Save.

You can now log in to the WordPress Admin Panel using these newly created admin credentials. Click Here if you would like to know about the procedure of accessing the WordPress Admin Panel.

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

Did this answer your question?