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

Add admin user to WordPress database

Share this article:

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.


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.


  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).
    – insert the username you want to use to access the WordPress Dashboard.
     – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot above).
    – you can leave this blank.
    – add the email you want to associate with this account.
    – you can leave this blank.
    – select the date/time for when this user is registered. Select a couple of days previous to the current date.
    – set this to 0.
    – 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 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:

Get Your Free Guide On Keeping Your WordPress Website Safe

White Label WordPress Maintenance Services UK Five Essentials To Keeping Your Site SafeGET MY FREE GUIDE