Add new WordPress admin
ThemeIsle content is free. When you purchase through referral links on our site, we earn a commission. Learn More

If your site 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 – you can create a new WordPress admin user by directly editing your site’s database.

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

How to create a new WordPress admin user with phpMyAdmin

Here’s how to create your new user…

Step 1: Access your MySQL database

First, you’ll need to access a tool called phpMyAdmin so that you can edit your database. You can usually do so via a link in your 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:

How 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.

Accessing the wp_users table in phpMyAdmin.

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:

Add a new WordPress admin with a new record in the users tables

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:

Add a new WordPress admin user with user login name and strong password

After clicking Go, you should see a success screen. 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:

New user added to the wp_user table

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 (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";}
Add user meta values to the new admin user

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 user using phpMyAdmin to restore access.

Have you tried the above method? Tell us how it went in the comments section below!

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Download free guide

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!