get in touch
Home » How to Add an Admin User to the WordPress Database via phpMyAdmin

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

Add admin user to WordPress database
Written by Gavin on 24th March 2021

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

Need a WordPress Maintenance Service? How about White Label?

WordPress support, ongoing website management
backups, security updates, white-label care plans and more.

Supercharge your agency with ThriveWP!

WordPress Maintenance Services UK

Other Posts you might like

Subscribe to our newsletter UK WordPress Maintenance Service

Subscribe To Our Newsletter For The Latest News & Info

Need a WordPress Maintenance Service?

menu-circlecross-circle