How to Add an Admin User to the WordPress Database via phpMyAdmin

24th March 2021

Add admin user to WordPress database

Adding a new admin user to WordPress via the database is actually quite a straight forward affair. Below we will show you how to achieve this and regain access to your website.

We have all been there, something breaks or you forget your password and which email address you used to access your site. Maybe you don’t even have the email account anymore so resetting your WordPress admin password won’t work either! Below we will show you how to add a new admin user to your site via the site’s database using phpMyAdmin. Follow the video or read on below. The strings of text you need are also located below.

Subscribe

Create a new admin user in phpMyAdmin

First things first. You need to login into your database, this can usually be done through your hosting. Once logged in it should look a little like this. The two tables we will be working with are wp_users and wp_usermeta. Your prefix may not be wp_ but that doesnt matter what we are looking for is users and usermeta table.

Database

  1. Click the wp_users table

    Once you have clicked on and entered the wp_users table you will then need to click insert at the very top of the page.

  2. On the insert page fill in the details.

    You will need to fill in the ID with an ID number that is not in use or leave it blank for the system to auto-select one. (If you leave blank, after clicking go you will need to go back to the user’s table to see which ID you were assigned as you will need this for the next step)
    ID – pick a number (in our example, we will use the number 3).
    user_login 
    – insert the username you want to use to access the WordPress Dashboard.
    user_pass
     – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot above).
    user_nicename 
    – you can leave this blank.
    user_email 
    – add the email you want to associate with this account.
    user_url 
    – you can leave this blank.
    user_registered 
    – select the date/time for when this user is registered. Select a couple of days previous to the current date.
    user_status 
    – set this to 0.
    display_name 
    – you can leave this blank.
    Once you have filled the form in click go.

  3. Go back to the main table list and find wp_usermeta

    Click the wp_usermeta table and then again at the top click insert.
    unmeta_id – leave this blank (it will be auto-generated)
    user_id – this will be the id of the user you created in the previous step. Remember we picked 3.
    meta_key – this should be wp_capabilities
    meta_value – insert this: a:1:{s:13:"administrator";s:1:"1";}

    You will see an additional box below the one you just filled in. Again add the details as follows.
    unmeta_id – leave this blank (it will be auto-generated)
    user_id – this will be the id of the user you created in the previous step. Remember we picked 3.
    meta_key – this should be wp_user_level
    meta_value – 10

    Once you have filled these all out click the go button on the last box you filled out (the one with wp_user_level
    That’s it! you have now added a new admin user to your WordPress database. just go you yourwebsite.com/wp-admin and log in using the details you just setup for that user.

Gavin Pedley

Gavin Pedley

Gavin is the guy behind the award-winning ThriveWP. He has over 18 years of experience creating, developing, hosting and managing WordPress websites.

Gavin regularly shares his expertise via the ThriveWP blog and Youtube channel, where he creates informative and helpful WordPress tutorial videos.

Connect with Gavin on FacebookLinkedin or Twitter.

Share this article

Subscribe to receive articles right in your inbox

Get Your Free Guide On Keeping Your WordPress Website Safe

Subscribe to learn how to keep your WordPress website safe, starting with this free guide. Unsubscribe with one click at any time.

We hate SPAM and promise to keep your email address safe. Here’s our privacy policy.

SEND ME MY FREE EBOOKS!​

Three amazing products that will enhance your website performance, ranking and maximise your income! Our eBook offer includes three eBooks in one bundle.

We hate SPAM and promise to keep your email address safe. Here’s our privacy policy.