New WordPress admin user.
When you purchase through referral links on our site, we may earn a commission. This supports our testing and helps us maintain our editorial independence.

If your WordPress website was hacked, you forgot your password, or for some reason, you cannot log in to your WordPress admin dashboard, do not despair. There’s another way to gain access to your user account – it requires creating a new WordPress admin user by directly editing your site’s database table.

In this post, we’ll show you how to add a new WordPress admin user via phpMyAdmin step by step and with no access to your dashboard. Let’s get started!

📚 Table of contents:

How to create a new WordPress admin user with phpMyAdmin 📝

💡 Note: if you’re looking for a hosting provider that offers access to phpMyAdmin, we recommend Bluehost or A2 Hosting. These two have been solid choices for all types of websites – as we’ve covered in numerous comparisons on the site.

Before making direct database edits, back up your database first. If you have shell or file access, you can also consider safer recovery methods such as WP-CLI or a temporary recovery script before editing tables manually.

Step 1: Access your MySQL database 🗄️

Before you add new user, you’ll need to access phpMyAdmin – it’s not a plugin, but rather a free software tool written in PHP – and edit your database. You can usually do so via a link in your WordPress hosting account dashboard.

The exact name varies depending on the host, but look for options such as:

  • phpMyAdmin
  • Database Manager

Here’s what it looks like in cPanel:

cPanel dashboard showing where to access phpMyAdmin

Step 2: Go to the wp_users table 🗃️

Now, select your WordPress site’s database from the list of databases on the left. Then, click on the wp_users table.

Note – some hosts change the prefix of the wp_users table for security. For example, you might see it as wpud_users. Just open the table that says [something]_users.

phpMyAdmin with a WordPress database open and the wp_users table selected

Step 3: Insert a new WordPress admin user in the users table 🧙‍♂️

In the wp_users table, click on the Insert tab.

On the next screen, you’ll see a form:

phpMyAdmin Insert form for creating a new row in the wp_users table

Fill in the following details:

  • user_login: Insert the username you want to use for your new admin user.
  • user_pass: Add a password for the account and select MD5 in the Function drop-down.
  • user_email: Add the email address you want to use.
  • user_registered: Select the date and time for when this user should be registered.
  • user_status: Set this value to zero.

Don’t worry about the other fields; leave them empty for now. Once you’ve filled out the fields, scroll to the bottom and click Go:

phpMyAdmin Insert form for wp_users filled with username, MD5 password, email, and registration date

After clicking Go, you should see a success screen confirming the activation of the above sequence. If you go back to the wp_users table, you should see your new user. Pay attention to the value in the ID column, as you’ll need this in the next step:

phpMyAdmin wp_users table displaying the newly created user and its ID

Step 4: Insert user meta values ✅

To finish things out, go to the wp_usermeta table and click on Insert. Again, the name might be slightly different – just look for the table that says [something]_usermeta.

Then, fill in the following values for one row (again, leave the other fields empty):

  • user_id: Fill in the ID of the user you created in the previous step.
  • meta_key: Enter wp_capabilities
  • meta_value: Fill in the field with a:1:{s:13:"administrator";s:1:"1";}
phpMyAdmin Insert rows in wp_usermeta for wp_capabilities and wp_user_level for the new user

Then insert one more row in the same table using the same user_id value:

  • meta_key: Enter wp_user_level
  • meta_value: Enter 10

If your site uses a custom database prefix, use that prefix for both values instead, such as wpud_capabilities and wpud_user_level.

Click on Go to complete the user creation process. You can now log in to your WordPress site using the credentials from Step 3.

Conclusion 🏁

As you can see, not all is lost if you’re locked out of your admin dashboard. It’s still possible to create a new WordPress admin login using phpMyAdmin to restore access. Such a situation can happen to ecommerce, small business, WordPress blogs, and all types of WordPress users alike.

If you are a beginner, remember that there are also plenty of video tutorials on that topic (you can even consider becoming a subscriber for future troubleshooting tips). If you enjoy SEO posts more, you can always search for resources that answer all the FAQs on the topic.

Have you tried the above method for regaining access to your WordPress site? Tell us how it went in the comments section below!

Yay! 🎉 You made it to the end of the article!

4 Comments
Newest
Oldest Most Voted
Helen
2 years ago

Thank you, worked perfectly . . . . .

Editor
1 year ago
Reply to  Helen

Thanks for reading.

Melak
2 years ago

This helped me a lot. Thanks indeed!

Editor
1 year ago
Reply to  Melak

Glad we were able to help.